Skip to content
This repository has been archived by the owner on May 21, 2023. It is now read-only.

Commit

Permalink
Merge pull request #13 from joshukraine/catalina-update
Browse files Browse the repository at this point in the history
Catalina Update
  • Loading branch information
joshukraine authored Mar 18, 2020
2 parents c047a65 + 8b83caf commit 17ad359
Show file tree
Hide file tree
Showing 11 changed files with 338 additions and 182 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Joshua Steele
Copyright (c) 2020 Joshua Steele

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
48 changes: 22 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

![mac-bootstrap screenshot][screenshot]

The purpose of this script is to provision a new machine running a fresh install of macOS. It installs and configures the software, dotfiles, and general preferences I use for web development — primarily [Ruby][ruby]/[Rails][rails] and [Node.js][nodejs]. The command line environment is based on Zsh (via [Oh-My-Zsh][omz]), [Vim][vim]/[Neovim][neovim] and [Tmux][tmux] running in [iTerm2][iterm2] or [Terminal.app][terminal].
This script will provision a new machine running a fresh install of [macOS Catalina (10.15)][catalina]. It installs and configures the software, dotfiles, and general preferences I use for web development — primarily [Rails][rails], [React][react], and [Vue][vue]. The command line environment is based on [Fish][fish] (or [Zsh][zsh]), [Neovim][neovim], and [Tmux][tmux] running in [iTerm2][iterm2] or [Terminal.app][terminal].

The [`bootstrap`][bootstrap] script is very specific to the Mac platform. Version 4.x has been successfully tested on the following versions of macOS:
The [`bootstrap`][bootstrap] script is very specific to the Mac platform. Version 5.x has been successfully tested on the following versions of macOS:

* Mojave (10.14)
* Catalina (10.15)

Previous versions of Mac Bootstrap have been successfully tested on the following versions of macOS:

* Mojave (10.14)
* High Sierra (10.13)
* Sierra (10.12)
* El Capitan (10.11)
Expand All @@ -28,10 +29,6 @@ Previous versions of Mac Bootstrap have been successfully tested on the followin

1. Reboot, check for additional updates, then reinstall and reboot as needed.

1. Install preliminary Mac apps. These would be any MAS or other apps referenced by the macos-dock script and not handled by `brew cask`. (See `install/macos-dock`)

**NOTE: MAS app installation was previously handled by the [`mas-cli`][mas-cli] utility. However, as of macOS Mojave, the signin functionality for `mas-cli` is broken. [View details here.](https://github.com/mas-cli/mas#-sign-in)**

## Installation

To install with a one-liner, run this:
Expand All @@ -47,20 +44,19 @@ less bootstrap
sh bootstrap 2>&1 | tee ~/bootstrap.log
```

WARNING: This script will ask for your admin password multiple times. You'll need to babysit it for a while. :)
WARNING: This script will ask for your admin password multiple times. You'll need to babysit it for a while. 😉

## What does it do?

When you invoke `bootstrap`, here's what it does:

* Step 1: Run my adaptation of thoughtbot's [Laptop script][laptop]. This is a provisioning script which installs lots of goodies like Homebrew, asdf, postgres, etc. My version is now stored locally in this repo under [`install/laptop`][my-laptop]. Step 1 also installs a variety of packages via [Homebrew Bundle][brew-bundle].
* Step 2: Install [Oh-My-Zsh][omz].
* Step 2: Install shell enhancements: [Oh My Fish][omf] for Fish, [Oh My Zsh][omz] for Zsh.
* Step 3: Clone [My Dotfiles for macOS][dotfiles] and symlink them to `$HOME`.
* Step 4: Install various [executable scripts][exe-scripts] (mostly for Tmux and Git) to `$HOME/bin`.
* Step 5: Set up a default [Tmuxinator][tmuxinator] profile for managing tmux sessions.
* Step 6: Install [Ukrainian spell-check dictionaries][dictionaries].
* Step 7: Install [Fira Code][fira-code] fixed-width font.
* Step 8: Set a variety of [macOS defaults][macos-defaults]. (adapted from [https://mths.be/macos][mths]) Step 8 also customizes the [macOS dock][macos-dock].
* Step 7: Set a variety of [macOS defaults][macos-defaults]. (adapted from [https://mths.be/macos][mths])

NOTE: Previously, I used the `bootstrap` script to set up many of the standard directories I use in my work. But since I now have [Dropbox Plus][db-plus], all those directories are downloaded automatically after Dropbox is installed. Once they've synced, I symlink them into place in `$HOME`.

Expand All @@ -72,8 +68,9 @@ After running `bootstrap` there are still a few things that need to be done.
* Install remaining software from Mac App Store or other sources.
* Install remaining Homebrew packages via [Brew Bundle][brew-bundle] with `brew bundle install`.
* Set up iTerm2 and/or Terminal.app profile (see details below).
* If using Fish, customize you setup by running the `fish_config` command.
* Launch Neovim and `:checkhealth`.
* Add personal data to `~/.gitconfig.local`, `~/.vimrc.local`, and `~/.zshrc.local`.
* Add personal data to `~/.fish.local` or `~/.zshrc.local`, `~/.gitconfig.local`, and `~/.vimrc.local`.
* Set up desired macOS keyboard shortcuts (see list below)

## Setting up iTerm2
Expand Down Expand Up @@ -117,26 +114,25 @@ No one else's development setup will ever be a perfect match for you. That said,

2) Review the `VARIABLE DECLARATIONS` section and customize as desired.

3) Review the 8 steps in [`bootstrap`][bootstrap] and make your own customizations. Here's an overview of what's going on:
3) Review the 7 steps in [`bootstrap`][bootstrap] and make your own customizations. Here's an overview of what's going on:

* Step 1 (required): Take a look at [Laptop][laptop] and see what you might want to tweak. One of the biggest things to review is the `brew bundle` list of packages and casks that will be installed. Customize as needed. Laptop also sets up some basics that are required by the bootstrap script later on.
* Step 2 (recommended): Use `oh-my-zsh`?
* Step 2 (recommended): Use Oh My Fish or Oh My Zsh?
* Step 3 (required): The dotfiles. Update the `$DOTFILES_*` variables (see [`bootstrap`][bootstrap] under "VARIABLE DECLARATIONS") to reference your dotfiles. As a starting point, you can [fork mine][dotfiles] and then point to your fork.
* Step 4 (recommended): Install scripts to `~/bin`?
* Step 5 (recommended): Set up Tmuxinator profile?
* Step 6 (optional): Install Ukrainian language utilities? Maybe you're interested in some [other language extensions][lang-extensions]?
* Step 7 (optional): Install Fira Code fixed-width font?
* Step 8 (optional): Review general macOS settings in `install/macos-defaults` and adjust as needed. `install/macos-dock` ensures that the dock contains only the apps you select. Adjust as desired. (NOTE: The `macos-dock` script depends on the `dockutil` package installed by Homebrew.)
* Step 7 (optional): Review general macOS settings in `install/macos-defaults` and adjust as needed.

4) Create `~/.gitconfig.local`, `~/.vimrc.local`, and `~/.zshrc.local` and add in your personal information. These files are sourced in `~/.gitconfig`, `~/.vimrc`, and `~/.zshrc` respectively.
4) Create `~/.fish.local` or `~/.zshrc.local`, `~/.gitconfig.local`, and `~/.vimrc.local` and add in your personal information. These files are sourced in `~/.config/omf/init.fish` or `~/.zshrc`, `~/.gitconfig`, and `~/.vimrc` respectively.

5) Update the README with your own info, instructions/reminders so you don't forget what you did, and especially the correct install URL:

```sh
curl --remote-name https://raw.githubusercontent.com/YOUR-GITHUB-USERNAME/mac-bootstrap/master/bootstrap && sh bootstrap 2>&1 | tee ~/boostrap.log
```

6) Run the script on your machine and wait for the first error. :) Then fix, commit, push, and repeat.
6) Run the script on your machine and wait for the first error. 😇 Then fix, commit, push, and repeat.

## Some of my favorite dotfile repos

Expand Down Expand Up @@ -167,31 +163,31 @@ curl --remote-name https://raw.githubusercontent.com/YOUR-GITHUB-USERNAME/mac-bo

## License

Copyright © 2018 Joshua Steele. [MIT License](https://github.com/joshukraine/mac-bootstrap/blob/master/LICENSE)
Copyright © 2020 Joshua Steele. [MIT License](https://github.com/joshukraine/mac-bootstrap/blob/master/LICENSE)

[bootstrap]: https://github.com/joshukraine/mac-bootstrap/blob/master/bootstrap
[brew-bundle]: https://github.com/Homebrew/homebrew-bundle#usage
[catalina]: https://www.apple.com/macos/catalina/
[db-plus]: https://db.tt/Kmoif6SG
[dictionaries]: https://extensions.openoffice.org/en/project/ukrainian-dictionary
[dotfiles]: http://jsua.co/dotfiles
[exe-scripts]: https://github.com/joshukraine/mac-bootstrap/tree/master/bin
[fira-code]: https://github.com/tonsky/FiraCode
[fish]: http://fishshell.com/
[iterm2]: https://www.iterm2.com/
[lang-extensions]: http://extensions.services.openoffice.org/en/search?f[0]=field_project_tags%3A157
[laptop]: https://github.com/thoughtbot/laptop
[macos-defaults]: https://github.com/joshukraine/mac-bootstrap/blob/master/install/macos-defaults
[macos-dock]: https://github.com/kcrawford/dockutil
[mas-cli]: https://github.com/mas-cli/mas
[mths]: https://mths.be/macos
[my-laptop]: https://github.com/joshukraine/mac-bootstrap/blob/master/install/laptop
[neovim]: https://neovim.io/
[nodejs]: https://nodejs.org/
[omf]: https://github.com/oh-my-fish/oh-my-fish
[omz]: http://ohmyz.sh/
[rails]: https://rubyonrails.org/
[ruby]: https://www.ruby-lang.org/en
[screenshot]: https://s3.amazonaws.com/images.jsua.co/mac-bootstrap-welcome-10-21-2018.png
[react]: https://reactjs.org/
[screenshot]: https://res.cloudinary.com/dnkvsijzu/image/upload/v1584124959/screenshots/mac-bootstrap-mar-2020_pmadrx.png
[stratus3d]: http://stratus3d.com/blog/2015/02/28/sync-iterm2-profile-with-dotfiles-repository/
[terminal]: https://en.wikipedia.org/wiki/Terminal_(macOS)
[tmux]: https://github.com/tmux/tmux/wiki
[tmuxinator]: https://github.com/tmuxinator/tmuxinator
[vim]: http://www.vim.org/
[vue]: https://vuejs.org/
[zsh]: https://www.zsh.org/
135 changes: 135 additions & 0 deletions bin/asdf.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
set -x asdf_data_dir (
if test -n "$ASDF_DATA_DIR"; echo $ASDF_DATA_DIR;
else; echo $HOME/.asdf; end)

function __fish_asdf_needs_command
set -l cmd (commandline -opc)
if test (count $cmd) -eq 1
return 0
end
return 1
end

function __fish_asdf_using_command -a current_command
set -l cmd (commandline -opc)
if test (count $cmd) -gt 1
if test $current_command = $cmd[2]
return 0
end
end
return 1
end

function __fish_asdf_arg_number -a number
set -l cmd (commandline -opc)
test (count $cmd) -eq $number
end

function __fish_asdf_arg_at -a number
set -l cmd (commandline -opc)
echo $cmd[$number]
end

function __fish_asdf_list_versions -a plugin
asdf list $plugin 2> /dev/null | sed -e 's/^[[:space:]]*//'
end

function __fish_asdf_list_all -a plugin
asdf list-all $plugin 2> /dev/null
end

function __fish_asdf_plugin_list
asdf plugin-list 2> /dev/null
end

function __fish_asdf_plugin_list_all
asdf plugin-list-all 2> /dev/null
end

function __fish_asdf_list_shims
ls $asdf_data_dir/shims
end

# update
complete -f -c asdf -n '__fish_asdf_needs_command' -a update -d "Update asdf"
complete -f -c asdf -n '__fish_asdf_using_command update; and __fish_asdf_arg_number 2' -l "head" -d "Updates to master HEAD"

# plugin-add completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a plugin-add -d "Add git repo as plugin"
complete -f -c asdf -n '__fish_asdf_using_command plugin-add; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list_all | grep -v \'*\' | awk \'{ print $1 }\')'
complete -f -c asdf -n '__fish_asdf_using_command plugin-add; and __fish_asdf_arg_number 3' -a '(__fish_asdf_plugin_list_all | grep (__fish_asdf_arg_at 3) | awk \'{ print $2 }\')'
complete -f -c asdf -n '__fish_asdf_using_command plugin-add; and __fish_asdf_arg_number 4'

# plugin-list completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a plugin-list -d "List installed plugins"

# plugin-list-all completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a plugin-list-all -d "List all existing plugins"

# plugin-remove completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a plugin-remove -d "Remove plugin and package versions"
complete -f -c asdf -n '__fish_asdf_using_command plugin-remove; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'

# plugin-update completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a plugin-update -d "Update plugin"
complete -f -c asdf -n '__fish_asdf_using_command plugin-update; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
complete -f -c asdf -n '__fish_asdf_using_command plugin-update; and __fish_asdf_arg_number 2' -a --all

# install completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a install -d "Install a specific version of a package"
complete -f -c asdf -n '__fish_asdf_using_command install; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
complete -f -c asdf -n '__fish_asdf_using_command install; and __fish_asdf_arg_number 3' -a '(__fish_asdf_list_all (__fish_asdf_arg_at 3))'

# uninstall completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a uninstall -d "Remove a specific version of a package"
complete -f -c asdf -n '__fish_asdf_using_command uninstall; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
complete -f -c asdf -n '__fish_asdf_using_command uninstall; and __fish_asdf_arg_number 3' -a '(__fish_asdf_list_versions (__fish_asdf_arg_at 3))'

# current completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a current -d "Display version set or being used for package"
complete -f -c asdf -n '__fish_asdf_using_command current; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'

# where completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a where -d "Display install path for an installed version"
complete -f -c asdf -n '__fish_asdf_using_command where; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
complete -f -c asdf -n '__fish_asdf_using_command where; and __fish_asdf_arg_number 3' -a '(__fish_asdf_list_versions (__fish_asdf_arg_at 3))'

# which completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a which -d "Display executable path for a command"
complete -f -c asdf -n '__fish_asdf_using_command which; and __fish_asdf_arg_number 2' -a '(__fish_asdf_list_shims)'

# latest completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a latest -d "Show latest stable version of a package"
complete -f -c asdf -n '__fish_asdf_using_command latest; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'

# list completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a list -d "List installed versions of a package"
complete -f -c asdf -n '__fish_asdf_using_command list; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'

# list-all completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a list-all -d "List all versions of a package"
complete -f -c asdf -n '__fish_asdf_using_command list-all; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'

# reshim completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a reshim -d "Recreate shims for version of a package"
complete -f -c asdf -n '__fish_asdf_using_command reshim; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
complete -f -c asdf -n '__fish_asdf_using_command reshim; and __fish_asdf_arg_number 3' -a '(__fish_asdf_list_versions (__fish_asdf_arg_at 3))'

# local completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a local -d "Set local version for a plugin"
complete -f -c asdf -n '__fish_asdf_using_command local; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
complete -f -c asdf -n '__fish_asdf_using_command local; and test (count (commandline -opc)) -gt 2' -a '(__fish_asdf_list_versions (__fish_asdf_arg_at 3)) system'

# global completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a global -d "Set global version for a plugin"
complete -f -c asdf -n '__fish_asdf_using_command global; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
complete -f -c asdf -n '__fish_asdf_using_command global; and test (count (commandline -opc)) -gt 2' -a '(__fish_asdf_list_versions (__fish_asdf_arg_at 3)) system'

# shell completion
complete -f -c asdf -n '__fish_asdf_needs_command' -a shell -d "Set version for a plugin in current shell session"
complete -f -c asdf -n '__fish_asdf_using_command shell; and __fish_asdf_arg_number 2' -a '(__fish_asdf_plugin_list)'
complete -f -c asdf -n '__fish_asdf_using_command shell; and test (count (commandline -opc)) -gt 2' -a '(__fish_asdf_list_versions (__fish_asdf_arg_at 3)) system'

# misc
complete -f -c asdf -n '__fish_asdf_needs_command' -l "help" -d "Displays help"
complete -f -c asdf -n '__fish_asdf_needs_command' -l "version" -d "Displays asdf version"
8 changes: 5 additions & 3 deletions bin/git-publish
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# https://github.com/christoomey/dotfiles/blob/77fb4084bd3f207aace80aa93a49769a6a298ddb/bin/git-publish
# Usage: git publish <remote-branch-name>
# Open the pull request page for <branch>, or the current branch if not
# specified. Lands on the new pull request page when no PR exists yet.
# The local branch must be tracking the remote branch.

def get_current_branch
def read_current_branch
`git rev-parse --abbrev-ref HEAD`.chomp
end

def main
current_branch = get_current_branch
current_branch = read_current_branch
if current_branch == "master"
$stderr.puts "Currently on master, aborting."
warn "Currently on master, aborting."
exit 1
else
system("git push -u origin #{current_branch}:#{current_branch}")
Expand Down
1 change: 1 addition & 0 deletions bin/mux.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tmuxinator.fish
24 changes: 24 additions & 0 deletions bin/tmuxinator.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function __fish_tmuxinator_using_command
set cmd (commandline -opc)
if [ (count $cmd) -gt 1 ]
if [ $argv[1] = $cmd[2] ]
return 0
end
end
return 1
end

set __fish_tmuxinator_program_cmd (commandline -o)[1]

function __fish_tmuxinator_program
eval "$__fish_tmuxinator_program_cmd $argv"
end

complete -f -c $__fish_tmuxinator_program_cmd -a '(__fish_tmuxinator_program completions start)'
complete -f -c $__fish_tmuxinator_program_cmd -n '__fish_use_subcommand' -x -a "(__fish_tmuxinator_program commands)"
complete -f -c $__fish_tmuxinator_program_cmd -n '__fish_tmuxinator_using_command start' -a "(__fish_tmuxinator_program completions start)"
complete -f -c $__fish_tmuxinator_program_cmd -n '__fish_tmuxinator_using_command open' -a "(__fish_tmuxinator_program completions open)"
complete -f -c $__fish_tmuxinator_program_cmd -n '__fish_tmuxinator_using_command copy' -a "(__fish_tmuxinator_program completions copy)"
complete -f -c $__fish_tmuxinator_program_cmd -n '__fish_tmuxinator_using_command delete' -a "(__fish_tmuxinator_program completions delete)"

abbr --add mux "tmuxinator"
11 changes: 6 additions & 5 deletions bin/tmuxinator.zsh
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#compdef _tmuxinator tmuxinator

_tmuxinator() {
local commands projects
commands=(${(f)"$(tmuxinator commands zsh)"})
projects=(${(f)"$(tmuxinator completions start)"})

if (( CURRENT == 2 )); then
_describe -t commands "tmuxinator subcommands" commands
_describe -t projects "tmuxinator projects" projects
_alternative \
'commands:: _describe -t commands "tmuxinator subcommands" commands' \
'projects:: _describe -t projects "tmuxinator projects" projects'
elif (( CURRENT == 3)); then
case $words[2] in
copy|debug|delete|open|start)
copy|cp|c|debug|delete|rm|open|o|start|s|edit|e)
_arguments '*:projects:($projects)'
;;
esac
Expand All @@ -17,8 +20,6 @@ _tmuxinator() {
return
}

compdef _tmuxinator tmuxinator mux
alias mux="tmuxinator"

# Local Variables:
# mode: Shell-Script
Expand Down
Loading

0 comments on commit 17ad359

Please sign in to comment.