Skip to content

Set up a fresh MacOS For Development

Spiros Kabasakalis edited this page Jun 17, 2018 · 3 revisions

This is mostly a note to myself on how to set up a fresh MacOS for Java Development. You can use these instructions to install Neovim and my dotfiles configuration, just follow them from the beginning up to Java section. If you are only interested in Neovim, you need only brew from the Bare Essentials (see below).

Important Disclaimer

Open source software changes rapidly and usually with no concern for backwards compatibility. I learned this the hard way when installing my dotfiles in a new Mac. Newest tmux and neovim versions introduced changes that broke my configurations resulting in annoying bugs. Fixing these bugs sometimes takes a persistent and time consuming research on relevant online resources. Just keep this in mind while installing my dotfile configuration in your system. I did the best I could to document my installation during an actual new setup.

Bare Essentials


  • Download and install Chrome
  • Install Magnet for Window Management
  • Install Brew
  • Assign Basic Fn keys (Settings/keyboard/shortcuts) F2 Focus on menu bar, F3 Focus dock, F4 next active window

Install iTerm2


brew cask install iterm2

Git


ssh-keygen -t rsa -C "kabasakalis@gmail.com" Copy the contents of the public key /Users/{user}/.ssh in my github and bitbucket key configurations.

ZSH


brew install coreutils
brew install zsh zsh-completions
Run zsh for default configuration. Copy the following line to .zshrc:
fpath=(/usr/local/share/zsh-completions $fpath)

Install oh-my-zsh:

curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh Switch shell from bash to zsh, in command line: chsh -s /bin/zsh The defaul .oh-my-zsh.zsh will be later overwritten from my dotfiles.

Install Powerline Fonts for Neovim

Download and install Powerline fonts.
cd fonts && install.sh

Devicons for NeoVim

Make sure neovim/plugins.vim file in dotfiles contains Plug 'ryanoasis/vim-devicons'
Install Nerd fonts simply with
brew tap caskroom/fonts
brew cask instald font-hack-nerd-font
Also checkout instructions in nerd-fonts

After you have installed powerline fonts and nerd fonts you have to use them in iTerm2. Go to iTerm2 preferences and assign your favorite powerline font as the main editor font, and your favorite nerd font as the non-character font (used to render file-icons among other eye candy).

Make zsh default shell

Add in .bashrc to make zsh default shell

if [ -t 1 ]; then
 exec zsh
fi

Install Neovim


brew install neovim

Install essential ruby gems

sudo gem install rubocop rubocop-rspec starscope ruby-beautify haml-lint scss-lint mdl neovim && npm install js-beautify && install exuberant-ctags && install xclip rcodetools

Tmuxinator

sudo gem install tmuxinator

Python

Install Python. This is required from Neovim.
brew install python (version 3)
brew install python@2 (version 2)
Then install these libraries:

pip3 install \
virtualenv \
flake8 \
isort \
jedi \
mistune \
psutil \
psutil \
setproctitle \
neovim \

pip2 install \
virtualenv \
flake8 \
isort \
jedi \
mistune \
psutil \
psutil \
setproctitle \
neovim \

Add in dotfiles/neovim/init.vim:
let g:python_host_prog = "/usr/local/bin/python2"
let g:python3_host_prog = "/usr/local/bin/python3"

Ruby

Mainly for awesome tmuxinator gem
Make appropriate changes in .zshenv (default ruby version if you want to install a version manager).

Install xclip

brew cask install xquartz
brew install xclip

Install node.js and neovim library

Install node.js, download pkg file.
Run in terminal npm install -g neovim

Install Silver Searcher (ag)

brew install the_silver_searcher

Install tmux

One of two ways:

  1. brew install tmux

  2. Run script, (edit version first) ./dotfiles/scripts/tmux_install.sh

You may not able to render powerline fonts in tmux

(bottom bar in screenshot).See my disclaimer on top of this page. I was not able to make this work with the newer version of tmux.

Install dotfiles

git clone git@github.com:kabasakalis/dotfiles.git in your home folder.
cd dotfiles
git submodule update --init --recursive (fetches dotbot)
./dotbot/bin/dotbot -d ~/dotfiles -c ~/dotfiles/installmac.conf.yaml

Start Neovim inside iTerm2

Start iTerm2 and then neovim with nvim executable and type command
:PlugInstall (Plugins may install automatically on neovim startup)

Tmuxinator sessions

Create yml configuration files inside dotfiles/tmuxinator folder, with name name, and start the session with alias txs name. Stop session with tks name.

Check Health of Neovim Installation

In neovim run :checkheath and make sure there are no errors or warnings.

JAVA


brew update
brew tap caskroom/cask
brew install brew-cask-completion
brew update && brew upgrade brew-cask-completion && brew cleanup && brew cask cleanup

Check if we already have JDK 6, 7, 8, 9 installed by Homebrew Cask:
brew tap caskroom/versions
brew cask info java6
brew cask info java7
brew cask info java8

To check JDK 10 (latest)
brew cask info java

Install Java 6, 7, 8, 10 (latest):

brew tap caskroom/versions
brew cask install java6
brew cask install java7
brew cask install java8

To install JDK 10 (latest):
brew cask install java

jEnv

brew install jenv

In .zshrc set:
eval "$(jenv init -)"
Add java paths in jenv, run in command line:
jenv add /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/
jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/
Check java versions:
jenv versions

Maven

brew update && brew install maven

Environmental variables in .zshenv
maven_version=3.5.3
export M2_HOME=/usr/local/Cellar/maven/$maven_version/libexec
export M2=$M2_HOME/bin
PATH=$M2_HOME/bin:$PATH

Gradle

brew update && brew install gradle

Environmental variables in .zshenv
gradle_version=4.7
export GRADLE_HOME=/usr/local/Cellar/gradle/$gradle_version/libexec
export GRADLE=$GRADLE_HOME/bin
PATH=$GRADLE_HOME/bin:$PATH

Jetbrains IDEs

Install IntellijIDEA, Webstorm, Datagrip

Install Codota

Go to codota site

Install Dash for offline documentation

Go to Dash