Mac OSX Setup

macOs Mojave icon

Reformat

Setup Xcode

xcode-select --install

M1 install rosetta

softwareupdate --install-rosetta

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 awscli autojump jq watchman
  • Apps
brew install --cask google-chrome iterm2 slack rectangle google-drive-file-stream dropbox virtualbox karabiner-elements hammerspoon sequel-pro fanny atom telegram ngrok blisk visual-studio-code fork docker

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

Python

VSCode Settings

{
  "files.useExperimentalFileWatcher": true,
  "workbench.editor.showTabs": false,
  "editor.fontSize": 14,
  "editor.tabSize": 2,
  "editor.renderWhitespace": "all",
  "editor.wordWrap": "on",
  "workbench.colorCustomizations": {
    "activityBar.background": "#20202a",
    "sideBar.background": "#2a2b38",
    "sideBar.border": "#3d3e51",
    "sideBarSectionHeader.background": "#3f4153",
    "editorGutter.background": "#26262f"
  },
  "explorer.confirmDragAndDrop": false,
  "breadcrumbs.enabled": true,
  "files.associations": {
    "*.hbs": "handlebars"
  },
  "cSpell.enabledLanguageIds": [
    "asciidoc",
    "c",
    "cpp",
    "csharp",
    "css",
    "git-commit",
    "go",
    "handlebars",
    "haskell",
    "html",
    "jade",
    "java",
    "javascript",
    "javascriptreact",
    "json",
    "jsonc",
    "latex",
    "less",
    "markdown",
    "plaintext",
    "pug",
    "python",
    "restructuredtext",
    "rust",
    "scala",
    "scss",
    "text",
    "typescript",
    "typescriptreact",
    "yaml",
    "yml"
  ],
  "[terraform]": {},
  "workbench.startupEditor": "newUntitledFile",
  "search.exclude": {
    "**/dist": true
  },
  "eslint.packageManager": "yarn",
  "prettier.packageManager": "yarn",
  "npm.packageManager": "yarn",
  "debug.node.autoAttach": "on",
  "[json]": {
    "editor.defaultFormatter": "vscode.json-language-features"
  },
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[xml]": {
    "editor.defaultFormatter": "mikeburgh.xml-format"
  },
  "editor.minimap.enabled": false,
  "workbench.editorAssociations": {
    "*.keystore": "default"
  },
  "[typescriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.suggestSelection": "first",
  "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
  "settingsSync.ignoredExtensions": ["bradlc.vscode-tailwindcss"],
  "cSpell.userWords": [],
  "files.exclude": {
    "**/.factorypath": true,
    "**/.project": true,
    "**/.settings": true
  },
  "workbench.editor.enablePreview": false,
  "editor.gotoLocation.multipleDefinitions": "goto",
  "workbench.colorTheme": "Horizon",
  "editor.formatOnSave": true,
  "jest.autoRun": "off",
  "git.ignoreMissingGitWarning": true,
  "editor.inlineSuggest.enabled": true,
  "window.zoomLevel": 3
}

VSCode Keyboard Shortcuts

// Place your key bindings in this file to override the defaultsauto[]
[
    {
        "key": "shift+alt+down",
        "command": "-editor.action.copyLinesDownAction",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+cmd+v",
        "command": "workbench.action.splitEditor"
    },
    {
        "key": "cmd+\\",
        "command": "-workbench.action.splitEditor"
    },
    {
        "key": "shift+cmd+s",
        "command": "-workbench.action.files.saveAs"
    },
    {
        "key": "ctrl+cmd+h",
        "command": "workbench.action.splitEditorOrthogonal"
    },
    {
        "key": "cmd+k cmd+\\",
        "command": "-workbench.action.splitEditorOrthogonal"
    },
    {
        "key": "shift+cmd+\\",
        "command": "-editor.action.jumpToBracket",
        "when": "editorTextFocus"
    },
    {
        "key": "shift+cmd+\\",
        "command": "workbench.files.action.showActiveFileInExplorer"
    },
    {
        "key": "cmd+b",
        "command": "-workbench.action.toggleSidebarVisibility"
    },
    {
        "key": "cmd+1",
        "command": "-workbench.action.focusFirstEditorGroup"
    },
    {
        "key": "cmd+1",
        "command": "workbench.action.toggleSidebarVisibility"
    },
    {
        "key": "cmd+e",
        "command": "-actions.findWithSelection"
    },
    {
        "key": "cmd+d",
        "command": "-editor.action.addSelectionToNextFindMatch",
        "when": "editorFocus"
    },
    {
        "key": "shift+cmd+d",
        "command": "editor.action.copyLinesDownAction"
    },
    {
        "key": "shift+cmd+d",
        "command": "-workbench.view.debug"
    },
    {
        "key": "cmd+k cmd+d",
        "command": "-editor.action.moveSelectionToNextFindMatch",
        "when": "editorFocus"
    },
    {
        "key": "cmd+g",
        "command": "-editor.action.nextMatchFindAction",
        "when": "editorFocus"
    },
    {
        "key": "cmd+d",
        "command": "editor.action.addSelectionToNextFindMatch"
    },
    {
        "key": "cmd+[",
        "command": "workbench.action.navigateBack"
    },
    {
        "key": "ctrl+-",
        "command": "-workbench.action.navigateBack"
    },
    {
        "key": "cmd+]",
        "command": "workbench.action.navigateForward"
    },
    {
        "key": "ctrl+shift+-",
        "command": "-workbench.action.navigateForward"
    },
    {
        "key": "cmd+[",
        "command": "-editor.action.outdentLines",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "cmd+]",
        "command": "-editor.action.indentLines",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+cmd+.",
        "command": "editor.action.codeAction",
        "args": {
            "kind": "source.fixAll.tslint",
            "apply": "first"
        }
    },
    {
        "key": "ctrl+cmd+r",
        "command": "workbench.action.reloadWindow",
        "when": "editorTextFocus"
    },
    {
        "key": "shift+cmd+.",
        "command": "-breadcrumbs.focusAndSelect",
        "when": "breadcrumbsPossible"
    },
    {
        "key": "shift+cmd+.",
        "command": "-editor.action.inPlaceReplace.down",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "shift+cmd+.",
        "command": "-breadcrumbs.toggleToOn",
        "when": "!config.breadcrumbs.enabled"
    },
    {
        "key": "shift+cmd+.",
        "command": "prettier.forceFormatDocument"
    },
]

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

Didn’t use brew services because it did not work as well

$ gitlab-runner install 
$ gitlab-runner start