Skip to content

Instantly share code, notes, and snippets.

@frizbee
Last active September 10, 2019 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frizbee/0ff3c41f29af8e5b1929df1a05cb2817 to your computer and use it in GitHub Desktop.
Save frizbee/0ff3c41f29af8e5b1929df1a05cb2817 to your computer and use it in GitHub Desktop.
Setup new Mac dev environment Mojave

Setup new Mac dev env

Homebrew

Setup brew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

ZHS

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

github repo

Setup dependencies

Run in terminal:

brew install zsh
brew install git
brew isntall node
brew install openssl
brew install macvim
brew install mysql
brew isntall postgresql
brew install wget
brew install yarn
brew install vim
brew install htop
brew install imagemagick
brew install mongodb
brew cask install macdown

One line:

brew install zsh git node openssl macvim mysql postgresql wget yarn vim htop imagemagick mongodb

VIM plugins

Installation

curl -L https://bit.ly/janus-bootstrap | bash

Customization

You can use ~/.gvimrc.before and ~/.vimrc.before for settings Janus itself uses, such as the leader setting. You may also use ~/.gvimrc.after and ~/.vimrc.after for any additional settings; it is also a good place for overriding Janus settings, as both files will be loaded at the end of Janus.

For example, to override the default color schemes:

$ echo 'color desert' >> ~/.vimrc.after

If you want to do additional customization or add more Vim plugins, create a ~/.janus directory and add your plugins there

$ cd ~/.janus
$ git clone https://github.com/vim-scripts/Rename2.git rename2

Install new color scheme gruvbox (optional)

$ cd ~/.janus
$ git clone https://github.com/morhetz/gruvbox.git

Vim AirLine plugin (optional)

$ cd ~/.janus
$ git clone https://github.com/bling/vim-airline

Ruby folding plugin (optional)

$ cd ~/.janus
$ git clone https://github.com/vim-utils/vim-ruby-fold.git

Surround plugin (optional) GitRepo

$ cd ~/.janus
$ git clone https://tpope.io/vim/surround.git
vim -u NONE -c "helptags surround/doc" -c q

Commentary plugin (optional) GitRepo

$ cd ~/.janus
$ git clone https://tpope.io/vim/commentary.git
vim -u NONE -c "helptags commentary/doc" -c q

Copy & paste it to ~/.vimrc.after

" color desert
" :hi Comment guifg=#999999

" https://github.com/morhetz/gruvbox.git
" color gruvbox
colorscheme gruvbox-material-soft
" let g:airline_theme = 'gruvbox_material'

" git clone https://github.com/bling/vim-airline
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'

" bind Ctrl+<movement> keys to move around the windows
map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-l> <c-w>l
map <c-h> <c-w>h

" Showing line number and length
" set number    " show line nmber
set tw=79     " width of document (used by gd)
set nowrap    " don't automatically wrap on load
set fo-=t     " don't automatically wrap text when typing
set colorcolumn=80
highlight ColorColumn ctermbg=233

" turn relative line numbers on
:set relativenumber
:set rnu

" Useful settings
set history=700
set undolevels=700

" Real programmers don't use TABs but spaces
set tabstop=2
set softtabstop=2
set shiftwidth=2
set shiftround
set expandtab

" Make search case insensitive
set hlsearch
set incsearch
set ignorecase
set smartcase

" Disable stupid backup and swap files - they trigger too many events
" for file system watchers
set nobackup
set nowritebackup
set noswapfile

" folding settings
" https://github.com/vim-utils/vim-ruby-fold.git
let g:ruby_fold_lines_limit = 200
set foldmethod=indent   "fold based on indent
set foldnestmax=10      "deepest fold is 10 levels
set nofoldenable        "dont fold by default
set foldlevel=1         "this is just what i use

" go to defenition
set isfname-=:

" Cursor settings:
highlight Cursor guifg=white guibg=black
highlight iCursor guifg=white guibg=white
set guicursor=n-v-c:block-Cursor
set guicursor+=i:ver25-iCursor
set guicursor+=a:blinkon0
" set guicursor+=n-v-c:blinkon0
" set guicursor+=i:blinkon0
"set guicursor+=i:blinkwait0


"  1 -> blinking block
"  2 -> solid block
"  3 -> blinking underscore
"  4 -> solid underscore
"  5 -> blinking vertical bar
"  6 -> solid vertical bar

GitHub repo

Ruby / Rails

brew install rbenv ruby-build
# Add rbenv to bash so that it loads every time you open a terminal
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile

# Install Ruby
rbenv install 2.6.3
rbenv global 2.6.3
ruby -v

Configuring Git

git config --global color.ui true
git config --global user.name "YOUR NAME"
git config --global user.email "YOUR@EMAIL.com"
ssh-keygen -t rsa -C "YOUR@EMAIL.com"

Set key for github/gitlab

The next step is to take the newly generated SSH key and add it to your Github account. You want to copy and paste the output of the following command and paste it here.

cat ~/.ssh/id_rsa.pub

Once you've done this, you can check and see if it worked:

ssh -T git@github.com or ssh -T git@gitlab.com

! If there is error:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0744 for '/home/geek/.ssh/id_rsa' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /home/geek/.ssh/id_rsa

To fix this, you’ll need to reset the permissions back to default:

sudo chmod 600 ~/.ssh/id_rsa
sudo chmod 600 ~/.ssh/id_rsa.pub

If you are getting another error:

Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/geek/.ssh/known_hosts).

This means that the permissions on that file are also set incorrectly, and can be adjusted with this:

sudo chmod 644 ~/.ssh/known_hosts

Finally, you may need to adjust the directory permissions as well:

sudo chmod 755 ~/.ssh

Resource

Rails

gem install rails

Rails is now installed, but in order for us to use the rails executable, we need to tell rbenv to see it:

rbenv rehash

For Mojave

Mojave changed the location of header files necessary for compiling C extensions. You might need to run the following command to install pg, nokogiri, or other gems that require C extensions:

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

Elasticsearch

brew tap elastic/tap

brew install elastic/tap/elasticsearch-full

brew install selenium-server-standalone

brew services start selenium-server-standalone Or, if you don't want/need a background service you can just run: selenium-server -port 4444

brew install geckodriver

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment