├── .gitignore ├── .DS_Store ├── Gemfile ├── Brewfile ├── .zshrc ├── Scripts ├── git.sh ├── ssh.sh └── os.sh ├── Snippets ├── mark_plain.codesnippet ├── mark_dependencies.codesnippet ├── mark_public_functions.codesnippet ├── mark_public_properties.codesnippet ├── mark_private_functions.codesnippet ├── test_imports.codesnippet ├── internal_extension.codesnippet ├── mark_viewcontrollerlifecycle.codesnippet ├── private_extension.codesnippet ├── public_extension.codesnippet ├── test_body.codesnippet ├── tableview_delegate.codesnippet ├── view_init.codesnippet └── tableview_datasource.codesnippet ├── setup.sh └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | Gemfile.lock 3 | Brewfile.lock.json -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielsaidi/osx/HEAD/.DS_Store -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source "https://rubygems.org" 4 | 5 | git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } 6 | 7 | # Web 8 | 9 | gem 'jekyll' -------------------------------------------------------------------------------- /Brewfile: -------------------------------------------------------------------------------- 1 | cask_args appdir: "/Applications" 2 | 3 | # Tools 4 | brew "bash-completion" 5 | 6 | # iOS/Swift 7 | brew "fastlane" 8 | brew "ffmpeg" 9 | brew "swiftgen" 10 | brew "swiftlint" 11 | 12 | # Apps 13 | cask "dropbox" 14 | cask "sourcetree" 15 | cask "spotify" 16 | cask "visual-studio-code" -------------------------------------------------------------------------------- /.zshrc: -------------------------------------------------------------------------------- 1 | # Copy this file to ~/ 2 | 3 | # Set English as default language 4 | export LC_ALL=en_US.UTF-8 5 | export LANG=en_US.UTF-8 6 | 7 | # Enable git completion 8 | zstyle ':completion:*:*:git:*' script ~/.zsh/git-completion.bash 9 | fpath=(~/.zsh $fpath) 10 | 11 | # Enable zsh completions 12 | plugins=(… zsh-completions) 13 | autoload -Uz compinit && compinit -------------------------------------------------------------------------------- /Scripts/git.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # DESCRIPTION 4 | # Configure git (e.g. adding aliases) 5 | 6 | 7 | echo " 8 | 9 | ******************* 10 | git 11 | ******************* 12 | 13 | Add the following to ~/.gitconfig : 14 | 15 | [color] 16 | ui = auto 17 | 18 | [tag] 19 | sort = -v:refname 20 | 21 | " 22 | 23 | read -p "Open ~/.gitconfig? [y/n] " response 24 | echo "" 25 | 26 | case $response in 27 | [yY][eE][sS]|[yY]) 28 | open ~/.gitconfig 29 | esac -------------------------------------------------------------------------------- /Scripts/ssh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # DESCRIPTION 4 | # Creates a new ssh key and copies it to the pasteboard 5 | 6 | echo " 7 | 8 | ******************* 9 | ssh 10 | ******************* 11 | " 12 | 13 | read -p "Create new SSH key? [y/n] " response 14 | case $response in 15 | 'yes'|'y') 16 | echo "" 17 | read -p "Enter your e-mail: " ssh_email 18 | echo "" 19 | echo "Creating ssh key" 20 | ssh-keygen -t rsa -b 4096 -C $ssh_email 21 | break;; 22 | esac 23 | 24 | echo "" 25 | 26 | echo "Adding ssh key to ssh-agent" 27 | eval "$(ssh-agent -s)" 28 | ssh-add ~/.ssh/id_rsa 29 | echo "" 30 | 31 | echo "Copying ssh key to pasteboard" 32 | pbcopy < ~/.ssh/id_rsa.pub 33 | 34 | echo "Done" 35 | echo "" -------------------------------------------------------------------------------- /Scripts/os.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # DESCRIPTION 4 | # Configure macOS and Install System Software (e.g. Homebrew, Cask etc.) 5 | 6 | echo " 7 | ******************* 8 | macOS 9 | ******************* 10 | " 11 | 12 | if ! command -v brew > /dev/null; then 13 | echo "Install Homebrew" 14 | ruby -e "$(curl --location --fail --silent --show-error https://raw.githubusercontent.com/Homebrew/install/master/install)" 15 | else 16 | echo "Update Homebrew" 17 | brew update 18 | fi 19 | echo "" 20 | 21 | echo "Install Brew Bundle" 22 | brew tap Homebrew/bundle 23 | echo "" 24 | 25 | echo "Enable tabbing between controls" 26 | defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 27 | echo "" 28 | 29 | echo "Enable developer mode" 30 | sudo /usr/sbin/DevToolsSecurity -enable 31 | echo "" 32 | -------------------------------------------------------------------------------- /Snippets/mark_plain.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | mark_plain 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | // MARK: - 13 | IDECodeSnippetIdentifier 14 | 6A7BC3C9-32A4-4EE8-A8DC-7848BC0E40F3 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Swift 17 | IDECodeSnippetTitle 18 | Mark 19 | IDECodeSnippetUserSnippet 20 | 21 | IDECodeSnippetVersion 22 | 2 23 | 24 | 25 | -------------------------------------------------------------------------------- /Snippets/mark_dependencies.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | mark_dependencies 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | // MARK: - Dependencies 13 | IDECodeSnippetIdentifier 14 | F3F64E74-1DBA-4426-750C-339477D15710 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Swift 17 | IDECodeSnippetTitle 18 | Mark - Dependencies 19 | IDECodeSnippetUserSnippet 20 | 21 | IDECodeSnippetVersion 22 | 2 23 | 24 | 25 | -------------------------------------------------------------------------------- /Snippets/mark_public_functions.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | mark_public_functions 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | // MARK: - Public Functions 13 | IDECodeSnippetIdentifier 14 | F3F64E74-1DBA-4426-850C-339477D15710 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Swift 17 | IDECodeSnippetTitle 18 | Mark - Public Functions 19 | IDECodeSnippetUserSnippet 20 | 21 | IDECodeSnippetVersion 22 | 2 23 | 24 | 25 | -------------------------------------------------------------------------------- /Snippets/mark_public_properties.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | mark_public_properties 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | // MARK: - Public Properties 13 | IDECodeSnippetIdentifier 14 | F3F64E74-1DBA-4426-850C-339477D15710 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Swift 17 | IDECodeSnippetTitle 18 | Mark - Public Properties 19 | IDECodeSnippetUserSnippet 20 | 21 | IDECodeSnippetVersion 22 | 2 23 | 24 | 25 | -------------------------------------------------------------------------------- /Snippets/mark_private_functions.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | mark_private_functions 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | // MARK: - Private Functions 13 | IDECodeSnippetIdentifier 14 | F8A5A8A5-169D-4C8A-AEBD-A36B6971C3BC 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Generic 17 | IDECodeSnippetTitle 18 | Mark - Private Functions 19 | IDECodeSnippetUserSnippet 20 | 21 | IDECodeSnippetVersion 22 | 2 23 | 24 | 25 | -------------------------------------------------------------------------------- /Snippets/test_imports.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | test_imports 7 | IDECodeSnippetCompletionScopes 8 | 9 | TopLevel 10 | 11 | IDECodeSnippetContents 12 | import Quick 13 | import Nimble 14 | import <# Pod #> 15 | IDECodeSnippetIdentifier 16 | CC77B1BC-5F0A-4F26-96DF-26A03D37ABB7 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Swift 19 | IDECodeSnippetTitle 20 | Test Import 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /Snippets/internal_extension.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | internal_extension 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | 13 | extension <# class #> { 14 | 15 | <# code #> 16 | } 17 | IDECodeSnippetIdentifier 18 | 18A5A9A2-269D-4C8A-BBCD-A36B6971C3BC 19 | IDECodeSnippetLanguage 20 | Xcode.SourceCodeLanguage.Generic 21 | IDECodeSnippetTitle 22 | Internal Extension 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /Snippets/mark_viewcontrollerlifecycle.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | mark_viewcontrollerlifecycle 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | // MARK: - View Controller Lifecycle 13 | IDECodeSnippetIdentifier 14 | C41B6C01-8886-46A5-AF34-5A4F6F64BD51 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Swift 17 | IDECodeSnippetTitle 18 | View Controller Lifecycle 19 | IDECodeSnippetUserSnippet 20 | 21 | IDECodeSnippetVersion 22 | 2 23 | 24 | 25 | -------------------------------------------------------------------------------- /Snippets/private_extension.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | private_extension 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | 13 | private extension <# class #> { 14 | 15 | <# code #> 16 | } 17 | IDECodeSnippetIdentifier 18 | 75A5AEAA-262D-1C8A-AEBD-A36B6971C3BC 19 | IDECodeSnippetLanguage 20 | Xcode.SourceCodeLanguage.Generic 21 | IDECodeSnippetTitle 22 | Private Extension 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /Snippets/public_extension.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | public_extension 7 | IDECodeSnippetCompletionScopes 8 | 9 | TopLevel 10 | 11 | IDECodeSnippetContents 12 | 13 | public extension <# class #> { 14 | 15 | <# code #> 16 | } 17 | IDECodeSnippetIdentifier 18 | 92A5AECE-262D-1C8A-AEBD-A36B6971C3BC 19 | IDECodeSnippetLanguage 20 | Xcode.SourceCodeLanguage.Generic 21 | IDECodeSnippetTitle 22 | Public Extension 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /Snippets/test_body.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | testbody 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | QuickSpec { 13 | 14 | override func spec() { 15 | 16 | describe("<# Test #>") { 17 | <# Test Code #> 18 | } 19 | } 20 | } 21 | 22 | IDECodeSnippetIdentifier 23 | 6B993D5F-D317-4BBA-9B61-B047361FF498 24 | IDECodeSnippetLanguage 25 | Xcode.SourceCodeLanguage.Swift 26 | IDECodeSnippetTitle 27 | Test Body 28 | IDECodeSnippetUserSnippet 29 | 30 | IDECodeSnippetVersion 31 | 2 32 | 33 | 34 | -------------------------------------------------------------------------------- /Snippets/tableview_delegate.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | tableview_delegate 7 | IDECodeSnippetCompletionScopes 8 | 9 | TopLevel 10 | 11 | IDECodeSnippetContents 12 | 13 | // MARK: - UITableViewDelegate 14 | 15 | extension <# class #>: UITableViewDelegate { 16 | 17 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 18 | <# code #> 19 | } 20 | } 21 | 22 | 23 | IDECodeSnippetIdentifier 24 | 44C52CAE-2B7A-4FD2-8CCA-5DDB378C0FCB 25 | IDECodeSnippetLanguage 26 | Xcode.SourceCodeLanguage.Swift 27 | IDECodeSnippetTitle 28 | TableViewDelegate 29 | IDECodeSnippetUserSnippet 30 | 31 | IDECodeSnippetVersion 32 | 2 33 | 34 | 35 | -------------------------------------------------------------------------------- /Snippets/view_init.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | view_init 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | // MARK: - Initialization 13 | 14 | convenience init() { 15 | self.init(frame: CGRect.zero) 16 | setup() 17 | } 18 | 19 | override init(frame: CGRect) { 20 | super.init(frame: frame) 21 | setup() 22 | } 23 | 24 | required init?(coder aDecoder: NSCoder) { 25 | super.init(coder: aDecoder) 26 | setup() 27 | } 28 | IDECodeSnippetIdentifier 29 | 36FBBFFA-F73E-443A-A8BF-787B0741EB83 30 | IDECodeSnippetLanguage 31 | Xcode.SourceCodeLanguage.Swift 32 | IDECodeSnippetTitle 33 | View - Init 34 | IDECodeSnippetUserSnippet 35 | 36 | IDECodeSnippetVersion 37 | 2 38 | 39 | 40 | -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # DESCRIPTION 4 | # Executes the command line interface. 5 | 6 | # USAGE 7 | # ./setup.sh [OPTION] 8 | 9 | # OPTIONS 10 | 11 | process_option() { 12 | case $1 in 13 | 'all') 14 | process_option 'os' 15 | process_option 'brew' 16 | process_option 'gem' 17 | process_option 'git' 18 | process_option 'ssh' 19 | break;; 20 | 'brew') 21 | brew bundle 22 | break;; 23 | 'git') 24 | source scripts/git.sh 25 | break;; 26 | 'os') 27 | source scripts/os.sh 28 | break;; 29 | 'ssh') 30 | source scripts/ssh.sh 31 | break;; 32 | 33 | 'q'|*) 34 | break;; 35 | esac 36 | } 37 | 38 | 39 | # MENU 40 | if [[ $# == 0 ]]; then 41 | echo " 42 | ******************* 43 | MENU 44 | ******************* 45 | 46 | Available commands: 47 | 48 | all: Setup everything 49 | 50 | brew: Install Brewfile Dependencies 51 | gem: Install Gemfile Dependencies 52 | git: Configure git (e.g. adding aliases) 53 | os: Configure macOS and install system tools 54 | ssh: Create & copy SSH key 55 | 56 | q: Quit/Exit. 57 | " 58 | 59 | read -p "Enter option: " response 60 | echo "" 61 | process_option $response 62 | else 63 | process_option $1 64 | fi -------------------------------------------------------------------------------- /Snippets/tableview_datasource.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | tableview_datasource 7 | IDECodeSnippetCompletionScopes 8 | 9 | TopLevel 10 | 11 | IDECodeSnippetContents 12 | // MARK: - UITableViewDataSource 13 | 14 | extension <# class #>: UITableViewDataSource { 15 | 16 | func numberOfSections(in tableView: UITableView) -> Int { 17 | return <# sections #> 18 | } 19 | 20 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 21 | return <# rows #> 22 | } 23 | 24 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 25 | <# code #> 26 | } 27 | } 28 | IDECodeSnippetIdentifier 29 | EA3C7DE6-1800-4264-B735-F5D8CB88DC03 30 | IDECodeSnippetLanguage 31 | Xcode.SourceCodeLanguage.Swift 32 | IDECodeSnippetTitle 33 | TableViewDataSource 34 | IDECodeSnippetUserSnippet 35 | 36 | IDECodeSnippetVersion 37 | 2 38 | 39 | 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OS X Setup Script 2 | 3 | This repository contains scripts that can be used to setup a brand new 4 | MacBook within minutes. It applies OSX settings, installs applications 5 | and npm packages and can even configure your SSH keys. 6 | 7 | 8 | ## How to use it 9 | 10 | To trigger the main setup script, run `./setup.sh`. This will take you 11 | to the main menu, where all available setup options are presented. You 12 | can also type `./setup.sh [OPTION]` to trigger a specific setup script. 13 | 14 | Once you run the `system` script, you get access to amazing tools like 15 | `Homebrew`, `Homebrew-Cask`, `Brew Bundle`, `RubyGems`, `NPM` etc. You 16 | will then be able to use `Brewfile` and `Gemfile` to manage packages. 17 | 18 | 19 | ## Brewfile 20 | 21 | `Brewfile` is used to specify which packages and applications you want 22 | to install with Homebrew and Homebrew Cask. You can update packages in 23 | this file by running the system script and selecting `brew`, or simply 24 | just run `brew bundle` from the terminal. 25 | 26 | 27 | ## Gemfile 28 | 29 | `Gemfile` is used to handle packages you want to install with RubyGems. 30 | You can update packages in this file, by running the system script and 31 | selecting `gem`, or simply just run `bundle install` from the terminal. 32 | 33 | 34 | ## NPM 35 | 36 | I use `Node` and `npm` to install web development software, as well as 37 | tools that I use for hybrid app development. However, since these libs 38 | are global, I manage these installations from `scripts/npm.sh` instead 39 | of a `package.json` file. 40 | 41 | 42 | ## Terminal 43 | 44 | For now, this repo contains a `.zshrc` file, that can be copied to `~/` 45 | and enables stuff like git autocomplete. It will also set git to apply 46 | English as standard language, which is nice for locales where Apple do 47 | apply that locale to git. 48 | 49 | 50 | ## Author 51 | 52 | Daniel Saidi, daniel.saidi@gmail.com --------------------------------------------------------------------------------