Mac OS

Useful Shortcuts

If you find these hard to remember, there’s a useful application called CheatSheet that you can use:

  brew cask install cheatsheet

After it’s installed, you can hold ⌘ and the list of keyboard shortcuts for the current application will appear.

Shortcut Function  
⌘ ⇧ [ Switch to previous tab  
⌘ ⇧ ] Switch to next tab  
⌘ [ Go back to previous page  
⌘ ] Go forward to next page  
⌘ ` Cycle through open windows of current app  
⌘ [tab] Cycle through open apps  
⌃ ↓ View all open windows of current app
⌃ ↑ View all open windows of every app  

Sleep, Restart, Shut Down, Log Out

Shorcut Function
⌥ ⌘ ⏏︎ Sleep
⌃ ⌘ ⏏︎ Restart
⌃ ⌥ ⌘ ⏏︎ Shut down
⌥ ⇧ ⌘ Q Log out

Document Editing

These work when editing text using Safari, Notes, and Mail, and any Mac OS application in general. They aren’t arbitrary, they’re the emacs hotkeys, and work on many applications, not just ones on Mac OS.

Shortcut Function
⌃ A Move to the beginning of the line
⌃ E Move to the end of the line
⌃ H Delete the character left of the the cursor
⌃ D Delete the character right of the cursor
⌃ U Delete all text left of the cursor
⌃ K Delete all text right of the cursor
⌃ O Add a newline without moving the cursor
⌃ T Swap the characters left and right of the cursor

Cursor Movement

If you’re ever stuck without arrow keys (it could happen!) you can take advantage of these 4 shortcuts.

Shortcut Function
⌃ F Move cursor →
⌃ B Move cursor ←
⌃ P Move cursor ↑
⌃ N Move cursor ↓

Tip: These look arbitrary, but they use a helpful pneumonic, hidden as it may be. Forward, Backward, Previous, Next.

Secret

Shortcut Function
⌘ , Open preferences window
⌘ ⇧ / Open help menu for current app
⌘ ⌃ F Open app in full-screen
⌥ ⌘ I Open inspect element

Tip: You can open inspect element in many more apps than you think. Give it a try!

Using the Terminal

# Immediately put the computer to sleep
pmset sleepnow
# Schedule for the computer to wake up weekdays @ 7:45AM
pmset repeat wakeorpoweron MTWRF 07:45:00
# Schedule for the computer to sleep on 12/24 @ 8:00AM
pmset schedule sleep "12/24/2019 08:00:00"
# Schedule for the computer to wake on 12/24 @ 8:00PM
pmset schedule wake "12/24/2019 20:00:00"
# Restart the computer immediately
sudo shutdown -r now
sudo shutdown -h now
sudo shutdown
# Dangerous, shuts computer down immediately
sudo halt

Finder

Shortcut Function
⌘ ⌫ Send file to trash
⌥ ⌘ ⌫ Completely delete a file
⌥ ⌘ ⇧ ⌫ Empty the trash
⌘ ⇧ N Create a new folder
⌥ ⌘ V Transfer copied file/folder to the current folder
⌘ ⇧ . Show hidden files/folders
⌘ E Eject selected disk/drive
Shortcut Function
⌘ ↑ Open the parent folder
⌘ ↓ Open the file/folder
⌘ → Open the folder (list view)
⌘ ← Close the folder (list view)

Opening Folders

Shortcut Function
⌘ ⇧ G Go to folder
⌘ ⇧ D Open the Desktop folder
⌘ ⇧ O Open the Documents folder
⌥ ⌘ L Open the Downloads folder
⌘ ⇧ H Open the Home folder
⌘ ⇧ A Open the Applications folder
⌘ ⇧ R Open the AirDrop folder
⌘ ⇧ I Open the iCloud folder

Adjusting the Finder Window

Shortcut Function
⌘ ⌥ P Show/hide the path bar
⌘ ⌥ S Show/hide the side bar
⌘ ⌥ T Show/hide the toolbar
⌘ ⇧ T Show/hide the tab bar
⌘ / Show/hide the status bar
⌘ ⇧ P Show/hide preview of selected file
⌘ 1 View folder’s items as icons
⌘ 2 View folder’s items as list
⌘ 3 View folder’s items as columns
⌥ ⌘ ⌃ 1 Sort files by name
⌥ ⌘ ⌃ 2 Sort files by type
⌥ ⌘ ⌃ 4 Sort by date added
⌥ ⌘ ⌃ 5 Sort by date modified

Safari

Shortcut Function
⌘ ⇧ \ Show all tabs
⌘ L Select the current page’s URL
⌘ ⇧ R Open in reader-view
⌘ ⇧ I Mail link of current page
⌥ [click] Download linked file
⌘ [click] Open link in a new tab
⌘ D Add current page to bookmarks
⌘ ⇧ D Add current page to reading list
⌥ ⌘ L Open the downloads folder
⌥ ⌘ E Reset the cache
⌘ ⇧ C Start/stop select element
⌥ ⌘ C Open JavaScript Console
⌥ ⌘ I Open/close inspect element (also closes JavaScript console)
⌥ ⌘ R Hard refresh page

Mail

Shortcut Function
⌘ ⇧ N Get new messages
⌘ N Write new message
⌥ ⌘ F Search mail for message
⌘ ⇧ D Send message
⌥ ⌘ J Empty junk mailbox
⌘ ⇧ ⌫ Empty trash mailbox
⌘ 1 View inbox
⌘ 2 View drafts
⌘ 3 View sent
⌘ 4 View junk
⌘ 5 View trash

Misc

Shortcut Function
⌥ ⌘ D Show/Hide the dock

Tip: You can add the control character to your usual screenshot command, to have screenshots save directly to your clipboard.

Change screenshot capture type

By default, screenshots save to .png but you can change this setting to .jpg or .pdf

Set default screen capture as .jpg

defaults write com.apple.screencapture type jpg && killall SystemUIServer

Change screenshot capture location

By default, screenshots save to ~/Desktop. I prefer them to be saved to ~/Downloads. You can change the screenshot capture location by running this command.

defaults write com.apple.screencapture location /Users/austin/Downloads && killall SystemUIServer

Warning: I had a little bit of trouble with this command. I don’t think it works anymore. As of Mac OS Mojave, you have to press ⌘ ⇧ 5, click options and then select Other Location… to choose a new default save location for screenshots.

Screenshot directly from terminal

There’s a hidden terminal command screencapture that you can use to capture a screenshot of your current window.

Capture the screen, save to example.png

  screencapture example.png
  • Capture the screen, save to the clipboard

    screencapture -c
    
  • Capture the screen, disable the “click” sound effect

    screencapture -x example.png
    
  • Capture the screen, (but after 10 second delay)

    screencapture -T 10 example.png &
    

Start screen recording from the terminal

You can even use screencapture to record video. The -V flag specifies to capture a video and the -A flag specifies to capture audio as well.

  • Record the screen for 10 seconds

    screencapture -V 10 example.mp4 &
    

This is mostly just for fun, it’s not as practical as the other ways to go about doing the same thing. If you don’t want to use the terminal type ⌘ ⇧ 5 which will give you a host of options to choose from. This is a new feature in OS X Mojave.

Change default screenshot location

I like to put my screenshots in the ~/Downloads directory. Luckily there’s a terminal command for that.

  • Set the directory of all future screenshots.

    defaults write com.apple.screencapture location ~/Downloads && killall SystemUIServer
    

Audio

Custom Sound Effects

You can change the alert sound on your Mac to any .aiff file. Your alert sounds are located in ~/Library/Sounds.

  • Convert a .mp3 to .aiff

    ffmpeg -i Input.mp3 Output.aiff
    cp Output.aiff ~/Library/Sounds/Custom.aiff
    

Move cursor with the mouse in terminal

This is a cool trick I just discovered. Start typing out a command on the terminal, and then hold ⌥

Now try clicking on a different part of the command you’re entering. It will move the cursor to that location!

Update Software in the Terminal

You can actually update the software on your computer directly from the terminal.

  • List available software updates

    softwareupdate -l
    
  • The -l flag is the list option

  • Install all updates

    # Short form
    sudo softwareupdate -iaR
    
    # Long form
    sudo softwareupdate --install --all --restart
    
  • The -i flag is the install option
  • The -a flag is the all option
  • The -r flag is the restart option, so the computer will restart and install the updates after they are downloaded

Fonts

  • The default terminal font, SF Mono, is by default hidden from the Font Book, and is available exclusively for use in the terminal app. To copy SF Mono to your computer’s Font Book, run this command.

    cp -R /System/Applications/Utilities/Terminal.app/Contents/Resources/Fonts/* /Library/Fonts
    

Disable User Photo

  • Although the GUI doesn’t give us an option to disable user-pictures, you can do it with the terminal command below.

    sudo dscl . delete ${HOME} jpegphoto
    

Setting Keyboard Shortcuts from Terminal

Store your keyboard shortcuts in the directory ~/Library/KeyBindings/DefaultKeyBinding.dict. Note that you have to first create ~/Library/KeyBindings since it won’t exist at first.

  • @ : ⌘
  • ^ : ⌃
  • ~ : ⌥
  • $ : ⇧

  • : \U2190
  • : \U2191
  • : \U2192
  • : \U2193

Note: Any shortcuts you make using this method will not appear in the keyboard shortcut settings page in your computer.

Fix Permissions

If you mess up your /etc files, like I did when I accidentally made every file executable, you can run this command to reset all of the permissions.

  • Reset system file permissions to default

    diskutil resetUserPermissions / $(id -u)
    

If you mess up your /etc/sudoers file, you’ll have to boot into single-user mode with ⌘ S during power on. From there, you can enter the following commands.

  • Reset sudoers file

    mount -uw /
    chown root:wheel /etc/sudoers
    chmod 440 /etc/sudoers
    reboot
    

defaults

defaults is a powerful tool to utilize when exporting and importing settings across machines. Although there is no built-in method to sync keyboard shortcuts across computers, you can use the defaults program to set various keyboard shortcuts. When doing so, refer to the syntax below for how to denote modifier keys:

Tip: You can replace NSGlobalDomain with the -g flag to specify that the defaults command is global in scope.

  • Disabling key repeat

    defaults write -g InitialKeyRepeat -int 10
    
  • Resetting key repeat to default settings

    defaults write -g InitialKeyRepeat -int 15 # 225 ms
    defaults write -g KeyRepeat -int 2 # 30 ms
    

Customize Launch Application for File Extension

The file that controls which app launches for a file is located here:

  ~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist

Delete FaceTime Popup

pkill -9 FaceTimeNotif

macOS notes

  • Notes are stored in a sqlite database, located on your computer at ~/Library/Containers/com.apple.Notes/Data/Library/Notes/

Default Application

You can install the command duti on homebrew to configure the default application that opens when you click on a file with a particular file extension. I’ve included an example below:

  • Setting default application used for .c files.

    # Set apple as the default editor for .c files
    duti -s com.apple.Xcode public.c editor
    # Check the current handlers performed by a UTI
    duti -l com.apple.Safari
    # Describe information about the default app for extension `mp4`
    duti -x mp4
    

Delete FaceTime Popup

pkill -9 FaceTimeNotif

macOS notes

  • Notes are stored in a SQLite database, located on your computer at ~/Library/Containers/com.apple.Notes/Data/Library/Notes/

SVG to PNG

# Convert `example.svg` into a 1000x1000 .png file
qlmanage -ts 1000 -o . example.svg

networksetup

The networksetup command allows you to configure your System Preference’s Network settings directly from your terminal.

  • Get the current DNS servers

    networksetup -getdnsservers Wi-Fi
    
  • Configure the DNS servers

    networksetup -setdnsservers Wi-Fi 1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001
    
  • Get the local machine’s MAC address

    networksetup -getmacaddress Wi-Fi | awk '{print $3}'
    
  • Configure the SOCKS proxy

    ssh -fNCD 3339 bastion@remote.site
    networksetup -setsocksfirewallproxy Wi-Fi 127.0.0.1 3339
    
  • Enable the SOCKS proxy

    networksetup -setsocksfirewallproxystate Wi-Fi on
    
  • Disable the SOCKS proxy

    networksetup -setsocksfirewallproxystate Wi-Fi off
    

airport

There is a hidden command, called airport. To use it, add the following directory to your ${PATH}

  /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
  • Scan available WiFi networks

    airport -s
    
  • Disconnect from the current WiFi network

    airport -z
    
  • List preferred wireless networks

    networksetup -listpreferredwirelessnetworks en0
    
  • Remove a preferred wireless network

    networksetup -removepreferredwirelessnetwork en0 <network>
    
  • Connect to a WiFi Network

    networksetup -setairportnetwork en0 <WiFi name> <password>
    

scutil

  • Get the computer’s name

    scutil --get ComputerName
    
  • Set the computer’s name

    scutil --set ComputerName "Tommy's MacBook Pro"
    
  • Get the host name

    scutil --get HostName
    
  • Set the host name

    scutil --set HostName "nova"
    
  • Get the localhost name (used for Bonjour)

    scutil --get LocalHostName
    
  • Set the localhost name (used for Bonjour)

    scutil --set LocalHostName "nova"
    

tmutil

  • If you have a Time Capsule, you can use the tmutil utility to interface with Time Machine from your terminal.

  • Backups are stored in the following location:

    tmutil latestbackup
    # => /Volumes/Time Machine Backups/Backups.backupdb/My Macbook Pro/2019-08-07-061700
    

Note: You have to run all of these as root, so before using tmutil, start with sudo -i

  • Turn on Time Machine

    tmutil enable
    
  • Turn off Time Machine

    tmutil disable
    
  • Start backing up to the Time Capsule

    tmutil startbackup
    
  • Stop backing up to the Time Capsule

    tmutil stopbackup
    

Saving Local Snapshots

By default, Time Machine will create local snapshots, locally stored backup volumes when it can’t connect to your Time Capsule.

  • Enable Local Snapshots

    tmutil disablelocal
    
  • Disable Local Snapshots

    tmutil enablelocal
    

Excluding Certain Files & Folders

By default, Time Machine will back up everything on your drive. You may, however, have data from large directories stored elsewhere. If so, it might be a good idea to exclude that directory from Time Machine’s backups, in the interest of saving space.

  • Exclude files in the directory ~/Downloads from backups

    tmutil addexclusion ~/Downloads
    
  • Re-enable backups for files in the directory ~/Downloads

    tmutil removeexclusion ~/Downloads
    

Note: By default, Time Machine will continue to ignore the files in an excluded directory even if you move the directory somewhere else. To have an absolute path excluded instead, use the -p flag.

  • Exclude files in the absolute path ~/Downloads from backups

    tmutil addexclusion -p ~/Downloads
    
  • Re-enable backups for files in the absolute path ~/Downloads

    tmutil removeexclusion -p ~/Downloads
    

You can also check if a given file, directory, or volume is excluded

  • Check if a file is excluded

    tmutil isexcluded ~/Downloads
    # => [Included] /Users/austin/Downloads
    

Restoring Files

  tmutil restore

launchctl

macOS has a more robust alternative to cron which allows daemon processes to be triggered on a systematic fashion. Using the launchctl (launch control) command, you can create daemon processes that will automatically run by the system.

These files take the form of plist files and are found in several system directories:

  • /Library/LaunchAgents
  • /Library/LaunchDaemons
  • /System/Library/LaunchAgents
  • /System/Library/LaunchDaemons
  • ${HOME}/Library/LaunchAgents

If you write or install personal plist files, they will ideally go in the home directory. A good example file to begin understanding the syntax can be located in /System/Library/LaunchDaemons/ssh.plist, which is the file used to launch the ssh daemon server that listens for incoming ssh connections.

Sample launch agent, located in ~/Library/LaunchAgents/com.example.transmission.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
	<dict>
		<key>Label</key>
		<string>com.example.transmission</string>
		<key>ProgramArguments</key>
		<array>
      <!-- The absolute path to the executable file -->
			<string>/opt/bin/transmission-daemon</string>

      <!-- The first argument supplied to the program -->
			<string>--config-dir</string>

      <!-- The second argument supplied to the program -->
			<string>/Users/austin/.config/transmission/settings.json</string>

		</array>
	</dict>
</plist>

If you’re setting up processes in /Library/LaunchDaemons, which are run as the root user, then make sure to set the file permissions appropriately using chown root:wheel <file> and chmod 644 <file>

  • View launchctl information about a daemon process by its PID:

    sudo launchctl profinfo <PID>
    
  • View information about all services pertaining to a user’s UID:

    launchctl print user/$UID
    
  • View information about a particular running service under a user’s UID:

    # ~/Library/LaunchAgents/com.tommy.foo.plist
    launchctl print com.tommy.foo
    
  • For all daemon processes owned by the current user, print true if they are disabled

    launchctl print-disabled user/$UID
    

    Note: launchtl keeps an un-erasable record of disabled/enabled launch daemons. If you make a typo when adding daemon, and disable it, there is no way to erase it as an entry.

  • Enable a daemon service

    launchctl enable user/$UID/com.tommy.foo
    
  • Disable a daemon service

    launchctl disable user/$UID/com.tommy.foo
    
  • Launch a daemon service

    launchctl kickstart
    
  • Launch any executable file with arguments as a launchctl

    launchctl submit -l -- /path/to/executable 'arg1' 'arg2' 'arg3'
    

Hidden Users

  • Allow the creation of secret users, hidden if their UID is 500 or lower

    sudo defaults write /Library/Preferences/com.apple.loginwindow Hide500Users -bool YES
    
  • Create the user tommy

    dscl . create '/Users/tommy'
    
  • Make the user tommy a hidden user

    sudo dscl . create '/Users/tommy' IsHidden 1
    
  • Add tommy to the list of hidden users

    sudo defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array-add "tommy"
    
  • Make the user tommy a non-hidden user

    sudo dscl . create '/Users/tommy' IsHidden 0
    
  • Make the user tommy have the home directory /var/sosumi

    sudo dscl . create '/Users/tommy' NFSHomeDirectory '/var/sosmumi'
    
  • Hide the public share folder for the user whose long name is Tommy Trojan

    sudo dscl . delete "/SharePoints/Hidden Tommy Trojan's Public Folder"
    
  • Set tommy’s shell to /bin/zsh

    sudo dscl . create '/Users/tommy' UserShell '/bin/zsh'
    
  • Set tommy’s RealName to Tommy Trojan

    dscl . create /Users/<username> RealName 'Tommy Trojan'
    
  • Force the user tommy to set a new password

    sudo dscl . passwd '/Users/tommy' ''
    sudo pwpolicy -u username -setpolicy 'newPasswordRequired=1'
    sudo rm -r ~tommy/Library/Keychains/*
    
  • Get a list of all users short names

    sudo dscl . -list /Users
    
  • Get detailed info on a particular user

    sudo dscl . -read /Users/<username>
    
  • Get a specific value from a user

    dscl . -read /Users/<username> <key>
    
  • Get detailed info on all users

    dscl . -readall /Users
    
  • Get a specific value from all users

    dscl . -readall /Users <key>
    
  • Get concise information about all users

    dscl . ls /Users
    
  • Get all of the groups that user root is associated with

    dscl . -search /Groups GroupMembership root
    
  • Get the name os all of the groups

    dscl . ls /Groups
    

Single User Mode

  • Reboot the computer into single user mode

    sudo launchctl reboot -s system
    

    Power Sound

Playing the power sound

  afplay /System/Library/CoreServices/PowerChime.app/Contents/Resources/connect_power.aif

System Integrity Protection

If you need to make changes to the file system, it might require disabling system integrity protection. By default, the following directories are protected:

  1. /System
  2. /usr
  3. /bin
  4. /sbin
  5. /var

There are three directories that are not protected:

  1. /Applications
  2. /Library
  3. /usr/local
  • Disabling system integrity protection

    csrutil disable
    
  • Enabling system integrity protection

    csrutil enable
    
  • Checking system integrity protection

    csrutil status
    

Configuring the Login Page

  • Set username & password as the default format for the login page

    
    
  • Show additional info by clicking the clock in the top-right corner

    sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo IPAddress
    
  • Adding a welcome message to the login page

    # [ Adding the message ]
    sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText -string 'Welcome back'
    
    # [ Removing the message ]
    sudo defaults delete /Library/Preferences/com.apple.loginwindow LoginwindowText
    
  • Adding a script to run at login

    sudo defaults write com.apple.loginwindow LoginHook /path/to/script
    

    Note: It’s preferrable to have these processes launch as LaunchAgents, but LoginHooks still work in the latest version of macOS.

  • Adding a graphic+text banner to appear upon login

    sudo cp ./banner /Library/Security/PolicyBanner
    
  • Disable buttons on the login page

    sudo defaults write /Library/Preferences/com.apple.loginwindow ShutDownDisabled -bool true
    sudo defaults write /Library/Preferences/com.apple.loginwindow RestartDisabled -bool true
    sudo defaults write /Library/Preferences/com.apple.loginwindow SleepDisabled -bool true
    
  • Reenable buttons on the login page

    sudo defaults write /Library/Preferences/com.apple.loginwindow ShutDownDisabled -bool false
    sudo defaults write /Library/Preferences/com.apple.loginwindow RestartDisabled -bool false
    sudo defaults write /Library/Preferences/com.apple.loginwindow SleepDisabled -bool false
    
  • Disable the user icons from the login page

    sudo defaults write /Library/Preferences/com.apple.loginwindow SHOWFULLNAME -bool true
    

gcc

Build gcc by hand

# download gcc, unzip the tarball as the folder ~/Downloads/gcc

cd ~/Downloads/gcc && mkdir build && cd build && \

sudo ../configure \
--prefix=/opt \
--with-local-prefix=/opt \
--with-system-zlib \
--with-native-system-header-dir=/usr/include \
--disable-nls \
--disable-multilib \
--enable-languages=c,c++ \
--enable-threads=posix \
--with-gmp=/usr/local/opt/gmp \
--with-mpfr=/usr/local/opt/mpfr \
--with-mpc=/usr/local/opt/libmpc \
--with-isl=/usr/local/opt/isl \
--program-transform-name='s/++/xx/' \
--with-sysroot=/opt/sys

sudo make "BOOT_LDFLAGS=-Wl,-headerpad_max_install_names"

diskutil

Something learned from man hdiutil: /dev/rdisk nodes are character-special devices, but are “raw” in the BSD sense and force block-aligned I/O. They are closer to the physical disk than the buffer cache. /dev/disk nodes, on the other hand, are buffered block-special devices and are used primarily by the kernel’s filesystem code. In layman’s terms /dev/rdisk goes almost directly to disk and /dev/disk goes via a longer more expensive route

  • View available storage devices
diskutil list
  • Erase a hard drive’s partitions
sudo diskutil partitionDisk /dev/disk2 1 MBR "Free Space" "%noformat%" 100%
  • Copy image to a new hard drive
diskutil unmount /dev/disk2s1
sudo dd bs=1M if='/path/to/file.img' of='/dev/rdisk2' conv=sync
  • Copy the current hard drive into an image
# Exporting an SD card save
sudo dd bs=4M if=/dev/sdb of=raspbian.img

# Importing an SD card save
sudo dd bs=4M if=raspbian.img of=/dev/sdb
  • Eject a device
sudo diskutil eject /dev/rdisk2
  • Setting up Raspberry Pi
<<-EOF > /Volumes/boot/wpa_supplicant.conf
country=US # Your 2-digit country code
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
    ssid="the_network_name"
    psk="the_network_password"
    key_mgmt=WPA-PSK
}
EOF

Tip: With this file in place, Raspbian will move it in /etc/wpa_supplicant/ when the system is booted

  • Measure temperature of Raspberry Pi
vcgencmd measure_temp
# temp=51.0'C

You can find the interface names by using :

ls /sys/class/net/ The name will be one of the displayed sub-directories alongside “lo”.

You can then use the following command :

cat /sys/class/net/####/address

  • Enable vpn connection on port 3340

    kill $(lsof -ti :3340) &> /dev/null
    ssh -fNCD 3340 'ssh://bastion@52.52.124.230:22'
    networksetup -setsocksfirewallproxystate Wi-Fi on
    return 0
    
  • Disable vpn connection on port 3340

      kill $(lsof -ti :3340) &> /dev/null
      networksetup -setsocksfirewallproxystate Wi-Fi off
      return 0