loading...

My Mac Setup 2020 (for Elixir and Phoenix Development)

joseph_lozano profile image Joseph Lozano Updated on ・3 min read

I recently did a factory reset on my MacBook Pro. I thought that during the process I would write down what steps I took and what tools I used to get it ready for Elixir/Phoenix development. I am on MacOS 10.15.4

Somethings' Brewin

First thing I always do is install homebrew. Just follow the directions on the official website.

I use brew and brew cask to install almost everything. The only exceptions to this are programming languages (see below) Here's a list of everything I install on a fresh machine. Use brew cask <package> to install.

1password # My password manager of choice
firefox # I try to avoid the the tentacles of Google, so I use Firefox
clipy # Clipboard managers are invaluable
basecamp # I use basecamp personal (free) to keep track of what I am working on
visual-studio-code # Editor of choice
firacode # font of choice
openssl@1.1 # required for elrang
postgres # postgres.app
postico # postgres ui tool

Oh My Zsh

(Oh My Zsh)[https://ohmyz.sh/#install] is a must for me. Just follow the directions on the website. Since new versions of MacOS ship with ZSH as the default shell, its easier than ever. But if you are on an older version, you may need to install and set Zsh as your default shell. I use the gallois theme, and add the asdf plugin.

plugins=(git asdf)

ASDF

With all that installed, next is asdf-vm, my package manager of choice for programming languages. The main benefit it has over brew is that you can install older versions of programming languages, which isn't always possible with brew. Additionally, its nice to have one command for everything, rather than keeping track of kerl, kiex, nvm, etc. separately.

Head over to asdf to install. You can also use brew, but I prefer the git installation. Again, this lets me roll back if I need to. There is an issue with kerl the package manager that asdf uses behind the scenes, and the version of MacOS that I am on (10.15.4). Check out the following post to get it working: https://dev.to/andresdotsh/how-to-install-erlang-on-macos-with-asdf-3p1c

I am currently using the following versions, but you should use whatever is latest (asdf list-all <language>):

erlang 22.3.2 # takes a long time
elixir 1.10.3-otp-22
nodejs 14.0.0

You can set these (or whatever version) as the global default by using
asdf global <language> <version>, ex: asdf global elixir 1.10.3

VSCode

With that setup, we are almost done! Next is VSCode.
I use the following packages

Elixir LS # Aboslutely a must have
Beautify # Formatting html
dark+ Elixir

And I use the following settings in my settings.json

{
    "editor.fontFamily": "Fira Code",
    "editor.fontLigatures": true,
    "workbench.colorTheme": "dark+(elixir)",
    "files.autoSave": "onFocusChange",
    "editor.tabSize": 2,
    "editor.renderWhitespace": "boundary",
    "editor.parameterHints.cycle": true,
    "editor.renderControlCharacters": true,
    "files.trimTrailingWhitespace": true,
    "window.zoomLevel": 2,
    "editor.formatOnSave": true,
    "editor.wordWrapColumn": 100,
    "[json]": {
        "editor.defaultFormatter": "lonefy.vscode-JS-CSS-HTML-formatter"
    },
    "elixirLS.fetchDeps": false,
    "[HTML (EEx)]": {},
    "files.associations": {
        "*.js": "javascript",
        "*.ex": "elixir",
        "*.exs": "elixir",
        "*.eex": "HTML (EEx)",
        "*.leex": "HTML (EEx)",
        "*.html.EEx": "HTML (EEx)"
    },
    "beautify.language": {
        "js": [],
        "css": [],
        "html": [
            "HTML (EEx)"
        ]
    },
    "emmet.includeLanguages": {
        "HTML (EEx)": "html"
    }
}

"files.associations" and "beautify.language" is crucial to get autoformatting working correctly for *.eex files.

Gitlab and Github

Finally, set up your SSH keys so that you can clone and push your repositories. I primarily use Gitlab for my own personal projects (another blog post), and GitHub for things I intend to be public. Follow the instructions on Gitlab to setup a key, and add them to your accounts.

Closing

That's basically everything I did to set up my Mac for Phoenix and Elixir development in 2020. If I missed anything, or you just want to share what your setup looks like, comment below!

Posted on Apr 27 by:

joseph_lozano profile

Joseph Lozano

@joseph_lozano

LA -> NYC. Currently looking for new opportunities.

Discussion

markdown guide