blog.base2.io

We are Base Two, a technology company in Columbus, OH.

February 8, 2017 – Reed Dunkle Setting Up My Mac

In my first blog post I mentioned that Base Two provided me with a MacBook Pro as part of the apprenticeship program. Previously I had been running Ubuntu 16.04, and so I’ve had to learn the Mac way of doing things.

If you’re on a Mac, you’re likely to be familiar with how I set things up. But if you’re new to developing on a Mac, you’ll find this guide helpful.

  1. iTerm2
  2. Oh My Zsh
  3. Homebrew
  4. Python && Python3
  5. iPython && iPython3
  6. Atom
  7. Itsycal
  8. Shortcut to open terminal window

1. iTerm2

Mac users seem to use this instead of the default Terminal. I installed it, and I haven’t found a reason not to use it.

I like that it makes the background black without me having to mess with .bashrc (though #2 will take care of that anyways).

It loads a little more slowly than Ubuntu’s terminal, but it comes with extra features. For example, when there is a URL or directory path printed in the terminal, hold Cmd to render it as a clickable hyperlink.

You can set a default window arrangement, including number of windows, their positions, font size, etc. Refer to this StackOverflow answer.

Install

https://www.iterm2.com/


2. Oh My Zsh

I used this on Ubuntu also. It’s a zsh configuration, and it’s the only reason I’m using zsh instead of bash. I don’t really take advantage of the differences between the two.

I like the default theme, and especially how it handles Git repos. It provides excellent tab-completion upgrades. For example, tab-complete is case insensitive, and it also searches for available CLI arguments.

Most of all, I like that I can rely on it out of the box. I value the freedom to wipe and reinstall without much overhead.

Install

MacOS comes with zsh and curl already installed. To get Oh My Zsh set up, run the curl command found here:
https://github.com/robbyrussell/oh-my-zsh#via-curl

Note: zsh has its own config files.
~/.zshrc instead of ~/.bashrc
~/.zprofile instead of ~/.profile


3. Homebrew

This is a package manager like Ubuntu’s apt and apt-get. Commands I use:

brew update           # Update Homebrew and its formulae from the main repository
brew install <package>
brew uninstall <package>
brew upgrade <package>
brew outdated         # List all outdated packages
brew upgrade          # Upgrade all outdated packages to their newest versions
brew pin <package>    # Pin package at its current version, preventing upgrade
brew list             # Show all packages installed with Homebrew
Tips
  • Run brew update before using Homebrew as good practice.
  • After running brew upgrade, if a package isn’t working, run brew uninstall <package> and then re-install it, brew install <package>
Install

http://brew.sh/


4. Python && Python3

Mac comes with a system version of Python, but it’s better to leave that be. Instead, use these new installations for your work. (It took me too long to learn this.)

Install

Using Homebrew:

brew install python python3

Note: This also installs pip and pip3 (Python’s package manager)


5. iPython && iPython3

iPython

If you aren’t familiar with iPython I strongly recommend you try it out. As a Python REPL, it gives you a score of features over the plain interpreter.

It has syntax highlighting and tab-completion. It auto-indents your blocks as you type (functions, loops, etc). You can pull your code from the clipboard into the REPL with %paste, one of iPython’s magic functions. (It even ignores ‘+’ and ‘>’ characters for pasting from diff files or the basic interpreter.)

I could go on. It’s extremely powerful. If you play around in the Python REPL ever, use iPython instead.

Install

Using pip:

pip install ipython && pip3 install ipython

Note:

I found that ipython was running Python3. Test your installations:

  • Run ipython to ensure it runs on Python2
  • Run ipython3 to ensure it runs on Python3

If ipython runs on Python3:

  1. In one terminal, run where python2
  2. In another terminal, run where ipython, and open the output in a text editor
  3. Change the first line of the file from (2) to point to the output of (1).

Example (the specific outputs are apt to change):

where python2  # (1)
# /usr/local/bin/python2
where ipython  # (2)
# /usr/local/bin/ipython
atom /usr/local/bin/ipython  # (3)

The first line might look like this:

#!/usr/local/opt/python/bin/python3.6

Change it to point to (1):

#!/usr/local/bin/python2

While you’re at it, I recommend doing the same for where ipython3. It’s possible that it currently points to a specific version of Python 3.x. I like to change it to point to the output of where python3, in order to use the newest version of Python3 installed.


6. Atom

I used Sublime previously, and it has things that Atom doesn’t have yet. That said, the team uses Atom, so I’m going to stick with it for consistency.

It has a nice CLI package manager that works like Node’s, for example:

apm install linter
apm uninstall linter
apm ls

Atom was installed when I got the Mac, so there might have been some setup I’m not aware of. These are the community packages I have installed:

  • highlight-selected
  • linter
  • linter-eslint
  • linter-stylelint
  • pretty-json
  • react
Install

https://atom.io/


7. Itsycal

Itsycal

This is a mini-calendar for the menu bar. I didn’t realize how often I used Ubuntu’s until it was gone.

Install

https://www.mowglii.com/itsycal/

Note: To move menu bar icons around, hold the Cmd key, then click and drag the icon.


8. Shortcut to open terminal window

When I first got the Mac, I really missed the Ubuntu shortcut for opening a Terminal. I followed the steps in this Stack Overflow answer to set one up, but unfortunately it doesn’t work reliably.

Now I keep iTerm on the Dock for easy access, and press Cmd+N to open new windows from it.

There is also Spotlight, similar to Ubuntu’s Launcher. Press Cmd+Space to bring up its search bar.


Do you see things you disagree with, or things I could add or change to make this more helpful? Do you have questions and want to chat about any of this? Ping me in the comments @rdunkle.

blog comments powered by Disqus