Setting up my MacBook Pro
04 Dec 2018I received a Mac for work. It’s beautiful, it’s fancy, and I have no idea how to use it. I’m going to summarize here the steps I followed to set up my laptop, in particular getting git, python, and a compile environment.
Git
First up, git of course. Mac does not ship with an equivalent of apt-get, but you can install one of several package managers. I went for Homebrew. I didn’t want to have to install it in sudo mode (not sure this was such a big deal, in the end), so I decided to install it in my personal folder (/Users/local). But to make it possible to execute the softwares installed via Homebrew from any directory, I had to add the path to the directory where I installed Homebrew to my PATH. This is done by modifying the file paths
sudo vim /etc/paths
Also, during the install, I had to install the command-line tools from XCode. This part was handled automatically by Mac App Store. Once Homebrew was installed, I updated and upgraded
brew update
brew upgrade
With Homebrew installed, I can next install git with a simple command
brew install git
This installation of git ships with a bunch of other app, like gitk. The latter requires to have jdk installed, which I did from the website (can’t find the link now).
Next, I need autocomplete to make it work. For that you can simply install bash-completion
brew install bash-completion
Then you need to point you bashrc file to that command.
Update 2021-02-17
I didn’t have to change the file /etc/paths
. I directly changed $PATH
in my .zshrc
file. I suppose the modification of the /etc/paths
is more solid, but so far I haven’t run into any complications.
For the auto-completion, I added
autoload -Uz compinit && compinit
to my .zshrc
file.
To add the git branch in my terminal prompt (btw, brew install iterm
), I added
source /Users/bencrestel/Work/other/zsh_setup/zsh-git-prompt/zshrc.sh
after cloning the repo zsh-git-prompt. I fine-tuned the aspect of the prompt and ended up with
PROMPT='%B%F{blue}%n%f@%F{green}%m%f:%F{red}%~%b%f$(git_super_status) %# '
Docker
Still using Homebrew, I could install docker. However to have the nice Docker GUI with it, I had to use cask,
brew cask install docker
Update 2021-02-17
To specify a cask, now you need to do
brew install --cask docker
I also installed the desktop app.
Jekyll
Jekyll is nice to power simple, efficient blogs. You install via Ruby, and the instructions provided here were sufficient, except for a few jekyll modules (jekyll-gist, jekyll-seo-tag,…) which I had to install using gem again. But it worked in the end.
Update 2021-02-17
This time I installed ruby 3.0, which seems to work a bit differently. The first steps in the above link are still required, but next to install missing dependencies (webrick
, kramdown-parser-gfm
, jekyll-watch
,…), I had to use bundle add <...>
. This install the missing dependencies locally, only for your project. The only piece that I was missing was a Gemfile
; you can simply create a text file with that name and add the single line source "https://rubygems.org"
.
Then everytime you do bundle add <...>
, it adds a new line to that Gemfile
with that new dependency.
pipenv
Next, and still using Homebrew, I installed pipenv, which seems to be a nice lightweight environment manager that can be useful for software development. A nice little intro video is posted on that website.
pyenv
Pyenv is meant to be a simpler way to define environments. I installed via Homebrew. Then to create a Python 3.6 environment, you do
pyenv init
pyenv install 3.6.0
Note: It never worked for me
[mac
]