-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Blog] Setting up a new computer/laptop (macOS) #79
Comments
Setup steps - MacBook Pro 16" (2023) M2 Max (April 2023)macOS Ventura 13.2.1 Pre-BootstrapmacOS InstallerGo through the macOS installer, configure any settings as desired:
Install System / OS UpdatesOnce you've booted into macOS for the first time, it probably makes sense to check for any system updates (particularly major OS updates) and install those before continuing.
(Optional) Save snapshot of macOS default configAt this stage, it may also be useful to get a snapshot of the default configurations on a freshly installed version of macOS. This can be useful for updating the scripts that configure macOS Open Terminal and run the following: mkdir ~/Desktop/macOS-defaults/
mkdir ~/Desktop/macOS-defaults/domains
defaults read > ~/Desktop/macOS-defaults/defaults-read.txt
defaults domains > ~/Desktop/macOS-defaults/defaults-domains.txt
defaults export -globalDomain - > ~/Desktop/macOS-defaults/defaults-export-globalDomain.xml Then to export each individual domain's settings as #!/bin/bash
# ChatGPT Ref: https://chat.openai.com/chat/c03c1acf-5ba2-46a1-878e-020bb4715df6
# Define the output directory
output_dir="$HOME/Desktop/macOS-defaults/domains"
# Get a list of all domains
domains=$(defaults domains)
echo "Exporting domains..."
# Loop through each domain
IFS=", "
for domain in $domains; do
# Export the domain to an XML file
echo " $domain"
defaults export "$domain" - > "${output_dir}/${domain}.xml"
done Bootstrap(Optional) Install command line development tools.This will generally be performed as part of the Homebrew install script (see below), but if you want to do it manually, you can do this now (it's required for the default system installations of tools such as
If you try to run a command line tool such as
Install HomebrewHomebrew is a package manager that makes it easy to install all of the other applications we want on our machine. It can be easily installed by opening Terminal and running the following command: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" We used to have to manually set up the (Optional) Universal ControlIf you're setting up your new system while you still have your old one running, you can make use of macOS' Universal Control feature to share the same mouse/keyboard between both devices:
You can enable this by:
To make things easier, you probably also want to arrange your devices similar to how they are actually positioned in real life:
Once this is configured (potentially on both devices), you should be able to 'push' your pointer 'through' the edge of the screen from one device to the other. Dotfiles, defaults, and core applicationsClone
|
It would be cool to write about how I set up a new laptop, encoding some of my currently more manual processes, and the order that makes most sense in doing so.
Setting up a new laptop
Pre-Bootstrap
Go through the macOS installer, configure any settings as desired.
Once you've booted into macOS for the first time, it probably makes sense to check for any system updates (particularly major OS updates) and install those before continuing.
(Optional) At this stage, it may also be useful to get a snapshot of the default configurations on a freshly installed version of macOS. This can be useful for updating the scripts that configure macOS
defaults
(see 'dotfiles' section below)defaults read > ~/Desktop/macOS-defaults.txt
Bootstrap
(Optional) Install command line development tools.
This will generally be performed as part of the Homebrew install script (see below), but if you want to do it manually, you can do this now (it's required for the default system installations of tools such as
git
, etc)xcode-select --install
If you try to run a command line tool such as
git
before installing this, you will see a message similar to the following:Install Homebrew
Homebrew is a package manager that makes it easy to install all of the other applications we want on our machine.
It can be easily installed by opening Terminal and running the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Once this is done, you probably also want enable the homebrew 'cask' 'tap', to be able to instal non CLI applications as well:
Dotfiles, defaults and core applications
Once I have my basic bootstrap tools installed, I can clone my dotfiles repo, and run some more automated setup scripts to get my environment exactly how I like it.
Open Terminal and clone my dotfiles repo. Note that we use
https
(rather thanssh
) to clone for now, as we don't have ssh keys setup on our new machine yet:git clone https://github.com/0xdevalias/dotfiles.git ~/.dotfiles
Make any customisations you may need before running. At a minimum, I would suggest checking that the latest versions are setup in:
Note: I hit a number of issues when running this that we should figure how to fix:
After running the bootstrap, and restarting my terminal, it also seems as though it won't run all of the 'init scripts' correctly, due to missing programs, etc; which eventually cause the shell to exit with an error. These should either be included as part of a 'core required tools' step, or be smart enough to exit cleanly without running if those tools aren't already present:
If you see this, you can say
n
for the time being, then once your shell starts, run the following command to ensure the directories aren't world writeable:compaudit | xargs chmod g-w
Once everything is updated as desired, run
script/bootstrap
to install things:At time of writing, this will:
.gitconfig
*.symlink
files from the dotfiles repo into$HOME
bin/dot
whalebrew
and similar package management type things here too?antigen
is installedzsh
is installedNote that the automatic running of installs scripts is a little manual/haphazard at the moment, mostly because I don't necessarily want to automatically install everything on a new machine. I would suggest checking the code to see what will be run, and sanity checking that each is going to do what you want it to. A lot of these scripts end up being run once per new machine, so they can drift/become outdated from my 'ideal setup' over time.
Eventually I would like to clean this up and standardise it a bit more, to be a 'bare minimal' set (eg. core development environments for node, python, ruby, etc. Though I think when that happens, it may make sense to do so as part of adopting a dotfiles management tool (see 0xdevalias/dotfiles#8)
For now, refer to the below sections for a more 'manual' list of core installs/setup tasks for a new dev machine. I've roughly attempted to document them in the order I would follow, but this isn't necessarily a hard requirement.
Computer Name
sudo scutil --set ComputerName "newname"
(required)sudo scutil --set LocalHostName "newname"
(required)sudo scutil --set HostName "newname"
(probably not needed)dscacheutil -flushcache
(required?)scutil --get ComputerName
(was updated when I change computer name in system preferences)scutil --get LocalHostName
(was updated when I change computer name in system preferences)scutil --get HostName
("HostName: not set", even after configuring computer name in system preferences (but haven't restarted yet))Basic text/code editor
~/.dotfiles/sublimetext/install.sh
Generate SSH key for GitHub, GitLab, Bitbucket, etc
script/bootstrap
ssh-keygen -t ed25519 -C "[email protected]" -f ~/.ssh/github_YOURUSERNAME_ed25519
cat ~/.ssh/github_devalias_ed25519.pub | pbcopy
(this will copy it to the clipboard)[email protected]
~/.dotfiles/ssh/keys.init
so thatssh-keyinit
works correctlyssh-add
github_USERNAME_ed25519 bitbucket_USERNAME_rsa gitlab_USERNAME_rsa
ssh-keyinit
once after restarting our machine, and it will load the specified keys for uscd ~/.dotfiles
git remote set-url origin [email protected]:0xdevalias/dotfiles.git
Terminal/Shell (iTerm2)
~/.dotfiles/iterm2/install.sh
GPG (git commit signing, etc)
gpg
,pinentry-mac
):~/.dotfiles/gpg/install.sh
Keybase
brew cask install keybase
keybase pgp list
keybase pgp pull-private THEGPGKEYID
(repeat for other keys as required)signingkey
in~/.dotfiles/git/gitconfig.local.symlink
gpg --list-secret-keys --keyid-format LONG
git config --file ~/.gitconfig.local --set user.signingkey THE16CHARKEYID
script/bootstrap
or similarDevelopment Tools (Java, Node, Python, Ruby, Golang, Swift, Xcode, etc)
jenv
, etc):~/.dotfiles/java/install.sh
nodenv
, etc):~/.dotfiles/node/install.sh
pyenv
):~/.dotfiles/python/install.sh
rbenv
):~/.dotfiles/ruby/install.sh
goenv
)?swiftenv
)?brew cask install jetbrains-toolbox
~/.dotfiles/xcode/install.sh
(TODO: update this?)brew cask install sourcetree
(similar togitkraken
but free)/usr/local/bin/gpg
calledgpg2
ln -s /usr/local/bin/gpg /usr/local/bin/gpg2
Preferences -> Advanced -> GPG Program
/usr/local/bin
(it looks for a binary calledgpg2
in this folder)Repository -> Repository Settings -> Security
gpg2
binary as described abovebrew cask install gitkraken
(similar to SourceTree)brew cask install aws-vault
brew cask install docker
brew cask install postman
brew cask install insomnia
(optional, similar to postman)Web Browser
brew cask install google-chrome
brew cask install chrome-remote-desktop-host
Alfred
brew cask install alfred
Settings -> Advanced -> Syncing -> Set preferences folder
defaults read com.runningwithcrayons.Alfred
defaults read com.runningwithcrayons.Alfred-preferences
Settings -> General -> Alfred Hotkey
Settings -> Features -> Web Bookmarks
Settings -> Features -> Clipboard History
BetterTouchTool
brew cask install bettertouchtool
Dropbox -> Backup -> BetterTouchTool
)Default (THISCOMPUTER)
)Settings -> Standard Settings -> Basic -> Launch BetterTouchTool on Startup
Settings -> Advanced Settings -> General -> Enable automatic update checking
Settings -> Advanced Settings -> General -> Install Process Priority Helper Tool
Settings -> Advanced Settings -> Scripting BTT -> Allow External BetterTouchTool Scripting
Settings -> Advanced Settings -> Sync
Bartender
brew cask install bartender
Hyperdock
brew cask install hyperdock
Unsorted
The following don't have any complex setup scripts/environment required, so we can just manually install them with HomeBrew if desired:
brew cask install XXX
disk-inventory-x
flux
gemini
(duplicate file finder)viscosity
lastpass
dropbox
resilio-sync
fantastical
Preferences -> Accounts
Preferences -> Accounts -> Open maps in -> Google Maps
toggl
discord
signal
skype
telegram
zoomus
lastfm
(optional)plexamp
spotify
vlc
blackhole
native-access
soundflower
sidequest
sony-ps4-remote-play
steam
brew install XXX
(a small selection, seebrew.*.list
files for more)aria2
awscli
coreutils
dive
exiftool
ffmpeg
git
gnupg
go
gobuster
goreleaser
hub
jq
pcre
qemu
unrar
watchman
Unsorted
script/bootstrap
App Store
We also want to open the App Store, and install any past purchases we want on this machine:
Launchpad
Next we want to organise applications in Launchpad into appropriate folders. While this is controlled by a sqlite database, I'm not currently aware of any tools that allow us to do this automatically, so we'll do it manually for now:
Cleaning up an old laptop before selling/disposing
Unsorted
~/.netrc
~/.localrc
gpg --gen-revoke KEYID
gpg --import my_revocation.txt
gpg --keyserver pgp.mit.edu --send-keys KEYID
keybase pgp drop KEYBASEKEYID
Legacy
The text was updated successfully, but these errors were encountered: