January 09, 2015 | Read Online
Getting a new Mac (for me invariably a MBP) is bittersweet. It’s nice to have something shiny and powerful, but setup can be tedious—especially if you don’t remember the steps.
Every time I go through the process I vow to capture the steps next time. But no more.
- Configure the Shell
- Configure vim
- vim on the Command Line
- Install Homebrew
- Install Software
- Install RVM
- Install and Configure tmux
- Conclusion
- Notes
Configure the Shell
First I change my shell to zsh, for these reasons:
chsh -s $(which zsh)
Then I install Prezto and get my zsh configs from GitHub.
[NOTE: I actually don’t need to install it because I just copy over my existing repo, which I have on Github.]
Configure vim
Right after the shell is in order I like to fix vim. The reason is simple: Vim is used to edit most of the files in later steps, and I can’t stand using vim without my configs in place.
Really all I do here is copy over my .vim directory and .vimrc file, which is also in my Pristine project.
Now I have my shell and vim working.
Use vim on the Command Line
By default, both Bash and Zsh use emacs mode when editing the command line, meaning you use your cursor to move around inside the command you’re typing. I like Vim, so I use its language everywhere I can.
That includes editing commands I’m typing!
bindkey -v
Map escape to work the same way on the command line:
bindkey -M viins ‘jk’ vi-cmd-mode
Now you can move around in your history, edit commands, etc. all using vim language.
[NOTE: Once again, if you do everything in the Pristine project above, this will already be done for you.]
Install Homebrew
Homebrew is a package manager for OS X, and I think it’s the best one. You can install it like this:
[NOTE: Remember what I said about running commands from the internet?]
ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"
[NOTE: You need to know what you’re doing before you pipe the internet into your shell.]
Run doctor to make sure you’re in good shape:
brew doctor
Install Software
One thing I like to do is get OS X using GNU versions of common tools instead of the default BSD versions. We’ll do this using Homebrew. First we’ll run tap for dupes:
brew tap homebrew/dupes
Then install your software:
brew install findutils --default-names
brew install gnu-sed --default-names
brew install gnu-tar --default-names
brew install gnu-which --default-names
brew install gnutls --default-names
brew install grep --default-names
brew install coreutils
brew install binutils
brew install diffutils
brew install gzip
brew install watch
brew install tmux
brew install wget
brew install nmap
brew install gpg
brew install htop
Unsupervised Learning — Security, Tech, and AI in 10 minutes…
Get a weekly breakdown of what's happening in security and tech—and why it matters.
[NOTE: --default-names allows the tool to be installed with the same name that might already exist on the system, instead of a modified name that avoids conflict.]
Install RVM
Managing Ruby versions can be seriously annoying, but it’s made less so with RVM.
First we pull the PGP key:
gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
Then we install:
curl -sSL https://get.rvm.io | bash -s stable
Then install what you want to use:
rvm install 2.1.1
…and tell your system to use it:
rvm use 2.1.1
Now you’re using that version of Ruby system wide.
[NOTE:: You can go back to the default by giving rvm use system.]
Install and Configure tmux
I follow this each time.
Conclusion
This gets me to a somewhat sane state where I at least have some basic functionality in place.
I hope this has been helpful.
UPDATED: APRIL 2017
Notes
- The next stage of this evolution will be to script this entire thing: pulling from GitHub, updating configs, installing software, etc. If you know a solid project for doing that, let me know.
- My vim tutorial.
- My tmux tutorial.