macOS and Cheese

2026-01-16, Fri

This post intends to keep track of problems & solutions I've collected from macOS.

1. No Need for Xcode

Unless you really enjoy the GUI workflow provided by the Xcode IDE, most of the time it's only the CLI tools that we need for development. In this case, this is all you need:

xcode-select --install

2. Symlink of Python3

While trying to make symlink of python3 like this:

sudo ln -s /usr/bin/python3 /usr/local/bin/python

The following error pops up

$python 
xcode-select: Failed to locate 'python', requesting installation of command line developer tools.

In this case, try to link directly from the actual source, e.g.

sudo ln -s $(xcode-select -p)/usr/bin/python3 /usr/local/bin/python

which should get the job done.

3. Open Anyway

Aside from go to System Settings -> Privacy & Security -> Security, we can also run

xattr -d -r com.apple.quarantine /path/to/app

to remove the quarantine attribute from the application.

4. Man Page Warning

The following warning message: "This manpage is not compatible with mandoc(1) and might display incorrectly." shows up while viewing manul of tools installed through brew. This warning message occurs because macOS switched man page renderer from groff to mandoc, which doesn't support some GNU-specific formatting macros.

5. Clear GitHub credentials

When the personal access token expires, you could clear the stored credentials through following command

$ git credential-osxkeychain erase
host=github.com
protocol=https

6. Common Questions & Problems

7. UTM

7.1. Question: where is the UTM drive file located?

It's in ~/Library/Containers/com.utmapp.UTM/Data/Documents.

7.2. Question: How to remote SSH to UTM instance?

This could be done through Network Port Forwarding in UTM1:

  1. Shut down the VM
  2. Open VN Instance Settings -> Network Configuration -> Network
  3. Set Network Mode to Emulated VLAN
  4. Click New under Port Forward section with following rule:
    Protocol
    TCP
    Guest Port
    22 (Default SSH port)
    Host Port
    2222 (or other port you'd use on macOS)
  5. Star VM and Log into Guest OS through UTM
  6. (Optional) Install SSH server with

    sudo dnf install openssh-server
    

    This step is typically optional, because openssh-server should have been installed already.

  7. Start SSH Server

    sudo systemctl enable --now sshd
    

    Status of sshd could be verified through

    sudo systemctl status sshd
    
  8. Go to Host OS and try to log into UTM instance with:

    ssh -p 2222 guest_os_user@localhost
    
  9. (Optional) Copy local SSH public key to Guest server with

    ssh-copy-id -p 2222 guest_os_user@localhost
    

    or in the case of multiple key files:

    ssh-copy-id -p 2222 -i ~/.ssh/my_key.pub guest_os_user@localhost
    
  10. (Optional) Update ~/.ssh/config to add remote host configuration for simple access in future:

    Include config_utm
    

    with the new config file dedicated to UTM ~/.ssh/config_utm:

    Host guest_os
       HostName localhost
       User guest_os_user
       Port 2222
       IdentityFile ~/.ssh/my_key
    

    Now we can log into UTM VM through

    ssh guest_os
    

Notes:

  • If no SSH key exists, generate new one by

    ssh-keygen -t ed25519
    # or
    # ssh-keygen -t ed25519 -C "[email protected]"
    

    and follow instructions to complete the key generation.

  • To see current port number usage, try command lsof2

    sudo lsof -i -P -n | grep LISTEN
    

    To check whether port number 2222 is in use already, filter by the -i option

    lsof -i :2222 -P
    

7.3. How to start VM instance without GUI

Simply go to VM settings and delete the default Display. With port forwarding set up earlier, we could easily SSH to a running VM.

Footnotes: