The problem: on my M2 mac mini with a Logi Ergo MX bluetooth mouse, every time I make the mac mini to sleep, it immediately wakes up, which I guess is caused by the mouse. So I need to turn off the mouse first, then use keyboard shortcuts to make the mini sleep.

The steps:

System Settings –> Keyboard –> Keyboard Shortcuts … –> (Left panel) App Shortcuts –> “+” –> Select “Application” as “All Applications”, “Menu Title ” as “Sleep”, and “Keyboard Shortcut” as what key combination you press, e.g. Shift + Option + Command + S

The problem:

I’m using a 2015 MBP Pro, and I can SSH into a Ubuntu 22.04 desktop computer (with OpenSSH) in the same WiFi LAN.

After I suspend the Ubuntu machine, I want to wake it up from macOS.

The solution:

1. On Ubuntu machine, enable wake-on-wireless-lan (WoWLAN)

iw phy0 wowlan show
# if it shows "WoWLAN is disabled"
sudo iw phy0 wowlan enable magic-packet disconnect
iw phy0 wowlan show
# now it should show WoWLAN is enabled

Also, get the MAC address for later use

ip addr show $(awk 'NR==3{print $1}' /proc/net/wireless | tr -d :) | awk '/ether/{print $2}'

2. On macOS machine, use wakeonlan command to wake up

# if wakeonlan not installed
brew install wakeonlan
wakeonlan <ABOVE MAC ADDRESS>

  1. Run xcode-select –install first
  2. Run brew install graphviz
  3. Run mkdir /usr/local/Frameworks if the following errors occur:

Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied @ dir_s_mkdir – /usr/local/Frameworks
Error: Permission denied @ dir_s_mkdir – /usr/local/Frameworks

Parental Controls was enabled for the only administrator user of my mac (as a result, this admin was converted to a managed user). When I tried to install some software later, I was asked to enter an administrator username and password, which I no longer had.

The only solution seems to be adding an administrator user. There are many discussions on the web. On my Sierra 10.12.6, the process is a bit different from others:

  1. Press power button, and quickly press and hold CMD + S to enter Single User Mode  (i.e. root in console);
  2. The problem I encountered is, after Step 1, the screen flashes an error message “BuildUser(): error building a user of type xxx“, and then shows the normal user login window. After a few tries, I found I need to enter the password of a current user, and then the system enters Single User Mode. (Update: this is because FileVault is turned on, ref: https://support.apple.com/en-us/HT201573);
  3. In Single User Mode, mount the startup drive: /sbin/mount -uw /
  4. Then remove (or I think better rename) file: rm /var/db/.applesetupdone
  5. Reboot: reboot
  6. After rebooting, the system shows the login window again. Enter the password for the current user, and then the system will go through the process of creating a new admin user (like setting up the Mac for the first time).

Some other words: it seems the above process can be used to bypass parental controls (?).