By Chris Maki | August 22, 2018
I just got a new MacBook Pro, sweet machine, I love having 32gb of memory on my laptop. One of the things I always do when I get a new laptop is set it up from scratch. While I use Time Machine to back up my Mac, I don’t use it to setup my new system. There’s something about deciding what software you want on the new machine, choosing what to install and how to install it that’s always appealed to me. While it takes a bit longer to spin up a new laptop, I find the tailored process more satisfying.
One thing I realized while doing my most recent update, I forgot just how many utilities and tools I had installed on my old laptop. So before I get to installing Java, here are a few tools that I installed on my new Mac:
Emacs, an older version of Emacs comes with your Mac. This version runs like other MacOS applications, I like it’s colors and layout better than the terminal only version.
IntelliJ IDEA the best IDE you can get (most languages supported with the Ultimate Version)
Docker, not much to say here, other than I love Docker and its a great tool for your development environment.
If possible, I try to install as many tools as possible using
brew. Outside of the apps listed above, here’s how I typically configure my Mac:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 $ brew install asciidoctor (1) $ brew install bash-completion (2) $ brew install emacs $ brew install git $ brew install git-crypt $ brew install gnupg $ brew install httpie (3) $ brew install ispell $ brew cask install iterm2 (4) $ brew cask install java $ brew cask install java8 $ brew install jenv $ brew install postgresql $ brew install gradle (5) $ brew install jq $ brew install maven $ brew install python $ brew cask install tunnelblick (6) $ brew cask install viscosity $ brew install bash (7) $ brew install watch $ brew install watch (8) $ brew install hugo (9)
|1||Asciidoctor, if you like Markdown, you’ll love Asciidoctor, it’s more feature complete than Markdown, this is a good writeup on Asciidoctor vs. Markdown|
|2||base-completion how I ever lived without this I don’t know. For more see Bash Completion below.|
|4||iTerm2, I only recently switched to iTerm2 after a lifetime of using Terminal|
|5||Gradle, a great alternative to Maven (I use Maven too, see below)|
|6||Tunnelblick is a great free, open source UI for OpenVPN|
|7||install a modern version of bash for mac|
|9||hugo - Website builder|
Now that we’ve installed an updated version of
bash you’ll need to add it to your
$ cat /etc/shells (1) $ echo "/usr/local/bin/bash" | sudo tee -a /etc/shells (2) $ cat /etc/shells (3)
|2||check out this StackExchange page if you’d like to know about this|
|3||verify that we’ve added
Now update which shell you will use, the linux command
chsh, change your login shell will change your shell:
$ chsh -s /usr/local/bin/bash (1) $ exec bash (2)
|1||this will prompt you for your password|
|2||if you don’t want to open a new shell, reload your bash session|
Now that you are all set, open a new shell and check your bash version:
$ echo $BASH_VERSION 4.4.23(1)-release
Thanks to this post for the helpful instructions.
In addition to installing the latest version of Java, I also install Java 8 since so many projects still use Java 8. As of this writing, Java 10 is the current production version of Java and is installed via Homebrew
brew cask install java.
I’ve been using
jenv for a few years now, it’s like
rbenv except for Java.
jenv enables you to have multiple JDK instances installed and seamlessly move between different versions. Since Java’s not installed by default on your Mac anymore, I had a hard time finding where
brew installed each JDK. I kept getting tripped up around the
brew instead installs each JDK version under
/Library/Java/JavaVirtualMachines. Here’s how you can add each Java version to
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 $ brew cask install java $ brew cask install java8 $ $ jenv add /Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/ $ jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home $ $ jenv version system (set by /Users/chrismaki/.jenv/version) (1) $ $ java -version java version "10.0.2" 2018-07-17 Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13) Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode) $ $ jenv versions * system (set by /Users/chrismaki/.jenv/version) (2) 1.8 126.96.36.199 10.0 10.0.2 oracle64-188.8.131.52 oracle64-10.0.2
|1||by default, if you do nothing,
|2||the asterix in column one tells you which version of Java is configured, it also tells you which
Once you’ve added various JDKs to jevn, you can switch between Java versions easily:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 $ cd /tmp $ $ jenv global 1.8 $ $ jenv version 1.8 (set by /Users/chrismaki/.jenv/version) (1) $ $ jenv local 10.0 (2) $ jenv version 10.0 (set by /tmp/.java-version $ $ rm /tmp/.java-version $ jenv version system (set by /Users/chrismaki/.jenv/version) (3) $ $ jenv shell 10.0 (4) $ jenv version 10.0 (set by JENV_VERSION environment variable)
|1||update the global default to be Java 1.8|
|2||override the global version, we are now using Java 10.0. To unset the local Java version you need to delete the
|3||remove the local
There’s one last part to add, you need to update your
~/.bash_profile with the following:
eval "$(jenv init -)" export JAVA_HOME="$HOME/.jenv/versions/`jenv version-name`"
You can configure plugins with
jenv so tools like Maven will follow your
jenv settings. Here’s how you work with
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 $ jenv plugins (1) ant export golo gradle grails groovy lein maven sbt scala springboot vlt $ $ jenv enable-plugin maven (2) maven plugin activated $ jenv enable-plugin gradle (3) gradle plugin activated $ $ jenv enable-plugin export (4)
|1||this will list all the plugins
|2||enable maven support|
|3||enable gradle support|
For more info on
jenv see this page.
Since I use the command-line a lot, I love file name completion (I’m lazy that way).__ I’m pretty sure this has been a feature of zsh for some time but I never stuck with zsh, I’ve always been a
bash fan, so when I stumbled across bash completion I was pretty happy. I tend to not use a lot of aliases in bash either, I find if you are always remembering an alias, you are stuck when you use someone else’s machine. I think the muscle memory created by typing everything out has long-term benefits. Bash completion is a create compliment to this, since it only completes commands that are correct, it’s almost like a private tutor.
Here’s how to install bash completion and some docker completions:
$ brew install bash-completion $ brew install docker-completion $ brew install docker-compose-completion
I particularly like the
docker-compose completion, if you’ve ever tried to run just one container defined in a
docker-compose.yml you know it can be tricky to remember exactly which container to run. With
docker-compose-completion installed, you can do this (using the sample
docker-compose.yml found here: https://docs.docker.com/compose/wordpress/):
$ docker-compose run --rm (1) db wordpress (2)
|2||list of docker containers defined in the sample Wordpress docker-compose file|
10/05/2018 - update version of bash on my mac, via
brew install bash, see Tools install for more. Added
watchto brew list.
10/23/2018 - added
1/19/19 - added
Hugoand fixed asciidoc
1/29/19 - removed
linenumsfrom all code blocks, moving from WP to Hugo
2/15/19 - updated all formatting with move to full hugo site