Skip to content

Commit

Permalink
devdocs: document darwin setup
Browse files Browse the repository at this point in the history
  • Loading branch information
zowoq committed Dec 13, 2024
1 parent 1c6bdd7 commit 52b4a85
Showing 1 changed file with 123 additions and 0 deletions.
123 changes: 123 additions & 0 deletions devdoc/darwin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
### Darwin setup

NOTE: this guide is for Oakhost Mac Mini M4.

#### Setup temporary ssh keys

```sh
ssh-copy-id $USER@$IP
```

#### Setup passwordless sudo for admin group

```sh
echo "%admin ALL = (ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/admin-nopasswd
```

### Enable ssh access for all users

```sh
sudo dscl . change /Groups/com.apple.access_ssh RecordName com.apple.access_ssh com.apple.access_ssh-disabled
```

### Ensure that Xcode command line tools and/or application aren't installed

Also ensure there aren't multiple versions of `Xcode.app` in `/Applications`.

```sh
ls -la /Applications/
```

```sh
ls -la /Library/Developer/
```

If they are present, remove them and reset the developer directory path.

```sh
sudo rm -rf /Library/Developer/CommandLineTools
```

```sh
sudo rm -rf /Applications/Xcode.app
```

```sh
sudo xcode-select --reset
```

#### Check and install updates for current macOS version

Updating beyond the currently installed macOS version may not be advisable.

```console
> sw_vers -productVersion
12.1
```

```console
> softwareupdate --list
Software Update Tool

Finding available software
Software Update found the following new or updated software:
* Label: Command Line Tools for Xcode-13.2
Title: Command Line Tools for Xcode, Version: 13.2, Size: 577329KiB, Recommended: YES,
* Label: Command Line Tools for Xcode-13.4
Title: Command Line Tools for Xcode, Version: 13.4, Size: 705462KiB, Recommended: YES,
* Label: Command Line Tools for Xcode-14.2
Title: Command Line Tools for Xcode, Version: 14.2, Size: 687573KiB, Recommended: YES,
* Label: macOS Monterey 12.6.7-21G651
Title: macOS Monterey 12.6.7, Version: 12.6.7, Size: 11395817K, Recommended: YES, Action: restart,
* Label: macOS Ventura 13.4.1-22F82
Title: macOS Ventura 13.4.1, Version: 13.4.1, Size: 11494827K, Recommended: YES, Action: restart,
```

```console
> sudo softwareupdate --install --restart 'macOS Monterey 12.6.7-21G651'
```

`--restart` will reboot the machine automatically.

### Install nix

https://github.com/DeterminateSystems/nix-installer

```sh
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --no-modify-profile
```

`/nix/receipt.json` has a record of all the changes done by the nix installer.

```sh
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
```

### Install nix-darwin

```sh
nix --extra-experimental-features 'flakes nix-command' --option accept-flake-config true \
run 'github:LnL7/nix-darwin#darwin-rebuild' -- switch --option accept-flake-config true --flake 'github:nix-community/infra#$HOSTNAME'
```

Remove packages installed to the default profile.

```sh
sudo -H nix-env -q
```

```sh
sudo -H nix-env -e nix nss-cacert
```

Config check should show no warnings.

```sh
nix config check
```

Reboot.

```sh
shutdown -r now
```

0 comments on commit 52b4a85

Please sign in to comment.