Repository

Looks good to me!

User Tools

Site Tools


kb:intranet:platforms:macos

MacOS

Useful tools

I use a MacOS (Intel) on the side, so some tools that may be useful. Avoid exposing the system Python if possible, and use pyenv instead.

# Install brew
# Refer to the official docs, typing here only for my convenience
user:~$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
user:~$ brew update
user:~$ brew install pyenv
user:~$ brew install openssl readline sqlite3 xz zlib tcl-tk bind  # for dig
 
# MacOS from Catalina and up uses zsh instead of bash
# so write the pyenv injections into .zshrc and .zprofile instead
user:~$ echo $SHELL
zsh
user:~$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
user:~$ echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc\
user:~$ echo 'eval "$(pyenv init -)"' >> ~/.zshrc
user:~$ cp ~/.zshrc ~/.zprofile

Difficult to find software that can read temperatures:

  • sudo powermetrics --samplers smc: No smc sampler available
  • Can read out thermal percentage from some xdg thing, but no clear documentation on what this feature is
  • Intel PCM is the successor to some Intel monitoring software, but there is a need to sign the kext with an Apple Developer ID. Troublesome...
  • osx-cpu-temp does seem to work. Run make
    • ./osx-cpu-temp -c reads CPU temp
    • ./osx-cpu-temp -a reads ambient temp

For ffmpeg installation, pull the static build for MacOS from FFMPEG website, then copy to /usr/local/bin. Problem is MacOS has some extended permissions model, so need to (1) allow from "Privacy & Security" settings after running and being blocked once, (2) run it again and select allow on two additional pop-ups. Repeat for ffprobe and ffplay.

Other software:

  • On-screen keystroke viewer: Keycastr works fantastic, brew install --cask keycastr
  • OBS Studio: Just follow the instructions to give accessibility permissions.

Mounting volumes

Exceptionally great guide on using automount utility to mount drives on boot, here. This is immensely useful is conveying stability of network share to Mac users who just want it to work.

> cat /etc/auto_master
+auto_master
...
/-      auto_smb        -nosuid,noowners
/-      auto_afp        -nobrowse,nosuid

> cat /etc/auto_smb
/System/Volumes/Data/mount/{{MOUNT_DIR}}	-fstype=smbfs,soft,noowners,nosuid,rw ://{{USERNAME}}:{{PASSWORD}}@{{IP_ADDRESS}}:/{{MOUNT_PATH}}

# Set read-only (MacOS extended attributes for 'auto_master' to prevent overwrite)
> sudo chmod 600 /etc/auto_smb
> sudo chflags schg /etc/auto_master

> sudo automount -cv

Think there is a non-command line method, but figured would be good to know the fundamentals.

Creating an ISO from the App image

Most of the content came from here. First download the MacOS installers from the App Store, links here.

# Create a filesystem (or is it disk image?), then attach and mount it
user:~$ hdiutil create -o /tmp/Ventura -size 16384m -volname Ventura -layout SPUD -fs HFS+J
user:~$ hdiutil attach /tmp/Ventura.dmg -noverify -mountpoint /Volumes/Ventura
 
# Run script to write disk image contents to mount
user:~$ sudo /Applications/Install\ macOS\ Ventura.app/Contents/Resources/createinstallmedia --volume /Volumes/Ventura --nointeraction
user:~$ hdiutil eject -force /Volumes/Install\ macOS\ Ventura
 
# Convert DMG to ISO
user:~$ hdiutil convert /tmp/Ventura.dmg -format UDTO -o ~/Desktop/Ventura
user:~$ mv ~/Desktop/Ventura.cdr ~/Desktop/Ventura.iso
user:~$ rm -f /tmp/Ventura.dmg

https://klabsdev.com/definitive-guide-to-running-macos-in-proxmox

Running different OS on Apple devices

Changelog

  • 2024-06-19: Init for Mac Mini (Intel, 2018)

Boot the computer. When the startup sound is heard, press and hold Alt to open up the Startup Disk menu. Typically will have the main MacOS partition, as well as a "GRUB" MacOS recovery partition. The last one is probably the external boot you want.

Booting likely cannot be performed if the BIOS explicitly disables this, which is likely the default for Apple devices. In this case, first press and hold Cmd-R (Win-R) and then under the Utilities submenu open the "Startup Security Utility". The BIOS is locked with the admin user credentials of the MacOS.

  • Set Secure Boot to "No Security", which does not enforce any restrictions on the OS that can be loaded (the other two options allow only OS signed by Apple to be loaded, and one even has a network verification).
  • Set Allowed Boot Media to "Allow booting from external or removable media".

Network IP addresses

Ideally grep can do regex, but this flavor doesn't seem to support. In any case the ideal query string:

macos ~ % ifconfig | grep -P "(inet |mtu)"
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
	inet 127.0.0.1 netmask 0xff000000
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
anpi1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
anpi0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
en3: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
en4: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ap1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	inet 192.168.1.13 netmask 0xffffff00 broadcast 192.168.1.255
awdl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
llw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
utun1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1000
utun2: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
utun3: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
utun4: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
utun5: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
utun6: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
utun7: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1350
	inet 100.64.100.6 --> 100.64.100.5 netmask 0xffffffff

Routing table:

macos ~ % netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags           Netif Expire
default            192.168.1.1        UGScg             en0
127                127.0.0.1          UCS               lo0
127.0.0.1          127.0.0.1          UH                lo0
169.254            link#11            UCS               en0      !
192.168.1          link#11            UCS               en0      !
192.168.1.1/32     link#11            UCS               en0      !
192.168.1.1        4:42:1a:60:cb:f8   UHLWIir           en0   1140
192.168.1.22       90:9:d0:2c:bd:c8   UHLWIi            en0    633
192.168.1.88       c6:ce:14:f2:a6:f7  UHLWI             en0    101
192.168.1.143/32   link#11            UCS               en0      !
192.168.1.207      be:29:aa:6b:34:d1  UHLWI             en0     44
192.168.1.250      10:27:f5:21:cf:36  UHLWI             en0    358
192.168.1.255      ff:ff:ff:ff:ff:ff  UHLWbI            en0      !
224.0.0/4          link#11            UmCS              en0      !
224.0.0.251        1:0:5e:0:0:fb      UHmLWI            en0
255.255.255.255/32 link#11            UCS               en0      !

Internet6:
Destination                             Gateway                         Flags           Netif Expire
default                                 fe80::%utun0                    UGcIg           utun0
default                                 fe80::%utun1                    UGcIg           utun1
default                                 fe80::%utun2                    UGcIg           utun2
default                                 fe80::%utun3                    UGcIg           utun3
default                                 fe80::%utun4                    UGcIg           utun4
default                                 fe80::%utun5                    UGcIg           utun5
default                                 fe80::%utun6                    UGcIg           utun6
default                                 fe80::%utun8                    UGcIg           utun8
default                                 fe80::%utun9                    UGcIg           utun9

When DNS is a problem, replace the DNS servers with (courtesy of this website):

macos ~ % sudo networksetup -listallnetworkservices
macos ~ % sudo networksetup -setdnsservers Wi-Fi 1.1.1.1 8.8.8.8
macos ~ % networksetup -getdnsservers Wi-Fi
kb/intranet/platforms/macos.txt · Last modified: 11 days ago ( 9 February 2025) by justin