Setting up macOS Mojave for modern web development

Setting up macOS Mojave for modern web development

macOs Mojave icon

Setup Xcode

xcode-select --install

https://brew.sh

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install Apps & Tools

  • CLI
brew install terraform zsh zsh-completions docker docker-compose docker-machine awscli autojump jq watchman
  • Apps
brew cask install google-chrome iterm2 slack spectacle google-drive-file-stream dropbox virtualbox karabiner-elements hammerspoon sequel-pro fanny atom telegram ngrok blisk visual-studio-code fork

Oh My Zsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Node Version Manager

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash

Hyper Key

Based On http://brettterpstra.com/2017/06/15/a-hyper-key-with-karabiner-elements-full-instructions/

brew cask install karabiner-elements hammerspoon

ensure security and privacy is configured for both karabiner and hammersppon. When you open the application up it will ask to allow the permissions.

  • Update the ~/.config/karabiner/karabiner.json with the contents below
{
  "global": {
    "check_for_updates_on_startup": true,
    "show_in_menu_bar": true,
    "show_profile_name_in_menu_bar": false
  },
  "profiles": [{
    "complex_modifications": {
      "rules": [{
        "manipulators": [{
          "description": "Change caps_lock to command+control+option+shift. Escape if no other key used.",
          "from": {
            "key_code": "caps_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [{
            "key_code": "left_shift",
            "modifiers": [
              "left_command",
              "left_control",
              "left_option"
            ]
          }],
          "to_if_alone": [{
            "key_code": "escape"
          }],
          "type": "basic"
        }]
      }]
    }
  }]
}

hammer spoon config

  • ~/.hammerspoon/init.lua
  • then make sure to reload the config in the hammer spoon menu
-- global
local hyper = {"cmd", "alt", "ctrl","shift"}
local log = hs.logger.new('hammerspoon','debug')




-- open hide app
function openApp(name)
  local app = hs.application.get(name)




  log.i("open App")
  log.i(name)
  log.i(app)




  if app then
    if app:isFrontmost() then
      log.i("app hiding")
      app:hide()
    else
      log.i("app focusing ")
      app:mainWindow():focus()
    end
  else
    log.i("app launch ")
    hs.application.launchOrFocus(name)
  end
end


function atom()
  openApp("Atom")
end
hs.hotkey.bind(hyper, 'a', atom)


function chrome()
openApp("Google Chrome")
end
hs.hotkey.bind(hyper, 'g', chrome)


function iterm()
openApp("iTerm")
end
hs.hotkey.bind(hyper, 'i', iterm)


function vscode()
openApp("Visual Studio Code")
end
hs.hotkey.bind(hyper, 'c', vscode)

Iterm2 Arrow Key Fix

https://superuser.com/questions/357355/how-can-i-get-controlleft-arrow-to-go-back-one-word-in-iterm2

Steps

  1. Goto: ⌘, Preferences → Profiles → Keys → Keyboard Behavior
  2. Load Preset: Natural Text Editing iterm arrow key configuration

Atom Packages

apm install linter atom-beautify git-blame merge-conflicts emmet file-icons ide-css language-docker language-ember-htmlbars language-rust language-swift language-terraform last-cursor-position linter-eslint linter-ui-default react recent-files-fuzzy-finder tabs-to-spaces tree-view-filter tree-view-search-bar editconfig

Custom Theme

  1. Clone Repository
  2. Run custom package
cd dmraz-syntax && apm link 

Copy Atom Setup

cd dmraz-syntax 
cp -rf config/** ~/.atom/**

Brew Multi User Configuration

https://stackoverflow.com/questions/41840479/how-to-use-homebrew-on-a-multi-user-macos-sierra-setup

  • Determine the path of the brew prefix, ie. the path that will be used to store files related to working with homebrew echo $(brew --prefix)

  • Check that all users on the system who need access to brew are in the admin group echo $(groups $(whoami))

  • Optional Add a user to the admin group if a user needs access to brew Will require access / privileges to use the sudo command sudo dseditgroup -o edit -a $(whoami) -t user admin

  • Set the brew prefix path to be recursively owned by the admin group sudo chgrp -R admin $(brew --prefix)/*

  • Set the brew prefix path to be recursively writable by all users who are in the admin group sudo chmod -R g+rwX $(brew --prefix)/*

  • update owner (optional) sudo chown -R $(whoami) $(brew --prefix)/*

  • Verify the permissions of the brew prefix ls -lah $(brew --prefix)

brew 🍻

Gitlab Runner

https://docs.gitlab.com/runner/install/osx.html

  • Install the GitLab Runner
$ brew install gitlab-runner
  • Install the Runner as a service and start it
$ brew services start gitlab-runner