Prep work before we use the new setup
This commit is contained in:
12
macos/README.md
Normal file
12
macos/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# OSX
|
||||
|
||||
## Keyboard Remapping
|
||||
|
||||
* Remap caps lock to ctrl
|
||||
* After running the install script, open the Karabiner-Elements app, then go to preferences->Simple
|
||||
modifications and add a new item that maps `caps_lock` to `left_control`.
|
||||
|
||||
* Remap caps lock to esc on tap and ctrl on hold
|
||||
* After running the install script, follow this guide starting at step 2: https://web.archive.org/web/20200513031048/https://medium.com/@pechyonkin/how-to-map-capslock-to-control-and-escape-on-mac-60523a64022b
|
||||
* Note: I had some issues with vim sometimes losing the caps lock remap. I just went with the
|
||||
simple caps->ctrl remap.
|
||||
32
macos/capslock-to-ctrl-for-karabiner.json
Normal file
32
macos/capslock-to-ctrl-for-karabiner.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"title": "Change caps_lock to Esc and Control",
|
||||
"rules": [
|
||||
{
|
||||
"description": "Post Esc if Caps is tapped, Control if held.",
|
||||
"manipulators": [
|
||||
{
|
||||
"type": "basic",
|
||||
"from": {
|
||||
"key_code": "left_control",
|
||||
"modifiers": {
|
||||
"optional": [
|
||||
"any"
|
||||
]
|
||||
}
|
||||
},
|
||||
"to": [
|
||||
{
|
||||
"key_code": "left_control",
|
||||
"lazy": true
|
||||
}
|
||||
],
|
||||
"to_if_alone": [
|
||||
{
|
||||
"key_code": "escape"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
2
macos/env.platform
Normal file
2
macos/env.platform
Normal file
@@ -0,0 +1,2 @@
|
||||
export CMAKE_CXX_COMPILER=/Library/Developer/CommandLineTools/usr/bin/c++
|
||||
export CMAKE_C_COMPILER=/Library/Developer/CommandLineTools/usr/bin/cc
|
||||
78
macos/install
Normal file
78
macos/install
Normal file
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
source "$HOME/.dotfiles/script_helpers/printing.sh"
|
||||
source "$HOME/.dotfiles/script_helpers/core.sh"
|
||||
source "$HOME/.dotfiles/script_helpers/platform.sh"
|
||||
source "$HOME/.dotfiles/script_helpers/file_ops.sh"
|
||||
|
||||
printf "\n${BOLD}Installing key remap config...${NORMAL}\n"
|
||||
key_dest=$HOME/.config/karabiner/assets/complex_modifications/
|
||||
mkdir -p $key_dest
|
||||
make_link $HOME/.dotfiles/osx/capslock-to-ctrl-for-karabiner.json ${key_dest}/custom-capslock.json
|
||||
|
||||
#-----------------------------------
|
||||
# Homebrew packages
|
||||
#-----------------------------------
|
||||
|
||||
printf "\n${BOLD}Installing Homebrew packages...${NORMAL}\n\n"
|
||||
|
||||
brew_packages=(
|
||||
'openssl'
|
||||
'wget'
|
||||
'git'
|
||||
'rlwrap'
|
||||
'cmake'
|
||||
'vim'
|
||||
'sdl'
|
||||
'tree'
|
||||
'rmtrash'
|
||||
)
|
||||
|
||||
brew_cask_packages=(
|
||||
'rectangle'
|
||||
'karabiner-elements'
|
||||
)
|
||||
|
||||
for package in "${brew_packages[@]}"
|
||||
do
|
||||
printf "${BOLD}$package${NORMAL}\n"
|
||||
ret=$(brew list | awk /$package/)
|
||||
if [[ $ret == $package ]]; then
|
||||
printf "${MAGENTA}==> ${NORMAL}${YELLOW}Already installed!${NORMAL}\n\n"
|
||||
else
|
||||
eval "brew install $package"
|
||||
printf "\n"
|
||||
fi
|
||||
done
|
||||
|
||||
for package in "${brew_cask_packages[@]}"
|
||||
do
|
||||
printf "${BOLD}cask/$package${NORMAL}\n\n"
|
||||
ret=$(brew list | awk /$package/)
|
||||
if [[ $ret == $package ]]; then
|
||||
printf "${MAGENTA}==> ${NORMAL}${YELLOW}Already installed!${NORMAL}\n\n"
|
||||
else
|
||||
eval "brew cask install $package"
|
||||
printf "\n"
|
||||
fi
|
||||
done
|
||||
|
||||
# We have issues downloading Rust on 10.11 with the patched Homebrew checkout
|
||||
# so we'll install it using their script.
|
||||
bash -c "$(curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs)"
|
||||
|
||||
# For Vim search
|
||||
cargo install ripgrep
|
||||
|
||||
# The homebrew core ctags package is very old.
|
||||
brew install --HEAD universal-ctags/universal-ctags/universal-ctags
|
||||
|
||||
printf "\n${YELLOW}If you haven't already installed the Xcode dev tools then do so now by installing Xcode from the App Store:${NORMAL}\n"
|
||||
printf "When that finishes open a terminal and run the following:\n"
|
||||
printf " 1. ${YELLOW}sudo xcode-select --install${NORMAL}\n"
|
||||
printf " 2. ${YELLOW}sudo xcodebuild -license${NORMAL}\n"
|
||||
printf " 3. ${YELLOW}sudo xcode-select -s /Applications/Xcode.app/Contents/Developer${NORMAL}\n"
|
||||
|
||||
printf "\n${BOLD}Finished setting up OS X${NORMAL}\n"
|
||||
60
macos/pre_install
Normal file
60
macos/pre_install
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This is meant to be called from the main dotfiles install script.
|
||||
|
||||
if which tput >/dev/null 2>&1; then
|
||||
ncolors=$(tput colors)
|
||||
fi
|
||||
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
|
||||
RED="$(tput setaf 1)"
|
||||
GREEN="$(tput setaf 2)"
|
||||
YELLOW="$(tput setaf 3)"
|
||||
BLUE="$(tput setaf 4)"
|
||||
MAGENTA="$(tput setaf 5)"
|
||||
CYAN="$(tput setaf 6)"
|
||||
BOLD="$(tput bold)"
|
||||
NORMAL="$(tput sgr0)"
|
||||
else
|
||||
RED=""
|
||||
GREEN=""
|
||||
YELLOW=""
|
||||
BLUE=""
|
||||
MAGENTA=""
|
||||
CYAN=""
|
||||
BOLD=""
|
||||
NORMAL=""
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
printf "Installing Homebrew...\n"
|
||||
|
||||
# OSX 10.11 and earlier will issue certificate errors when Homebrew attempts to download packages
|
||||
# with curl. Detect if we're running on 10.11 or earlier and if so use a fork that passes the
|
||||
# --insecure option to curl.
|
||||
kernel_major="$(uname -r | sed 's/\..*//')"
|
||||
case $kernel_major in
|
||||
15 | 14 | 13) download_patched_homebrew=1 ;;
|
||||
*) download_patched_homebrew=0 ;;
|
||||
esac
|
||||
|
||||
if [[ $download_patched_homebrew -eq 1 ]]; then
|
||||
printf "${BOLD}Current MacOS kernel ${NORMAL}${YELLOW}$(uname -r)${NORMAL}${BOLD} requires a patched version of Homebrew...${NORMAL}\n"
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/sir-pinecone/brew/master/install.sh)"
|
||||
else
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
|
||||
fi
|
||||
|
||||
brew tap homebrew/core
|
||||
|
||||
printf "\nInstalling bash...\n"
|
||||
ret=$(brew list | awk /$package/)
|
||||
if [[ $ret == $package ]]; then
|
||||
printf "${YELLOW}Already installed!${NORMAL}\n"
|
||||
else
|
||||
eval "brew install bash"
|
||||
printf "\n${YELLOW}Finished installing updated version of bash.\nYou must now enable it. Run:${NORMAL}\n"
|
||||
printf " ${BOLD}sudo vim /etc/shells${NORMAL}\n"
|
||||
printf "${YELLOW}And add ${NORMAL}${BOLD}/usr/local/bin/bash${NORMAL}${YELLOW} to the end of the list. After that close your terminal and re-run the dotfiles install script.${NORMAL}\n"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user