macOS Terminal

macOS Terminal

Note: These terminal commands below have NOT been tested on Apple Silicon Macs yet, therefore some might not work on them.

Steps: 
1. Click Apple logo in menu bar and click Shutdown Mac.
2. Once Mac has been shutdown, press and hold the power button until you see “Loading startup options”.
3. Click Options, then click Continue and enter the password for your account if prompted.

Hold Command + R while booting your Mac.

Click *Command + Option + R + Power* on the keyboard (Hold power button for 2sec then let go then hold the other keys).

Type: defaults write com.apple.screencapture location ~/your/chosen/location
Then type: killall SystemUIServer

Enable: defaults write com.apple.Finder AppleShowAllFiles true; killall Finder

Disable: defaults write com.apple.Finder AppleShowAllFiles false; killall Finder

Command: Open (folder name)

Command: caffeinate -s (Keep your Mac awake while it’s charging)


Command: caffeinate (Keep your Mac awake till you close terminal)

Command: caffeinate -t 2400 (2400 is the amount of time in seconds that you want your Mac to stay awake)

Type: cd Downloads, then, type: curl -O (link to file)

Type: defaults write com.apple.screencapture disable-shadow -bool TRUE; killall SystemUIServer

To change the default name:
Type: Enable: defaults write com.apple.screencapture name "your chosen name"
Then: killall SystemUIServer

To change the default location:
Type: defaults write com.apple.screencapture location ~/your/chosen/location
Then type: killall SystemUIServer

To change the default file-type:
Type: defaults write com.apple.screencapture type jpg

Type: /usr/bin/security cms -S -N "Common Name of cert you want to use" -i /path/to/unsigned/profile.mobileconfig -o /path/to/newly/signed/profile.mobileconfig

1. Boot into Single User Mode ⌘ + S.
2. Mount the drive by typing /sbin/mount -uw /System/Volumes/Data then ↩.
3. Remove the Apple Setup Done file by typing rm /var/db/.AppleSetupDone then ↩.
4. Reboot by typing reboot then ↩.
5. Complete the setup process, creating a new admin account.

Type say, then after that type what ever you want your Mac to say.

To enable Type: openssl enc -aes-256-cbc -e -in (drag original file) -out (drag same file but with new name at the end)

To disable Type: openssl enc -aes-256-cbc -d -in (drag encrypted file) -out (drag same file but make a new name at the end where it showed the name of the file)

Type: defaults write com.apple.dock autohide-time-modifier -float 0; killall Dock
If you want to go back to normal type: defaults write com.apple.dock autohide-time-modifier; killall Dock

Type: defaults write com.apple.screencapture location ~/your/chosen/location
Then type: killall SystemUIServer

To Get Private iP type: ipconfig getifaddr en0

To Get External iP type: curl ipecho.net/plain; echo

To see list type: launchctl list

To remove service type: launchctl remove com.apple.service

Type: pmset sleepnow

First type: sudo nvram -c
Then type: sudo shutdown -r now

To enable shutdown timer type: sudo shutdown -h +(hours in minutes)

To cancel/abort shutdown timer type: sudo killall shutdown

To enable Lock Screen Message type: sudo write /Library/Preferences/com.apple.loginwindow LoginwindowText "Custom Text Here"

To disable Lock Screen Message type: Default: sudo write /Library/Preferences/com.apple.loginwindow LoginwindowText

Type: ditto (drag original folder) (drag new folder)

Type: security find-generic-password -wa (SSID)

Type: system_profiler SPDisplaysDataType |grep Resolution

Type: while x=1; do /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep CtlRSSI; sleep 0.5; done
If you want to stop press control + c.

To enable root user Type: dsenableroot
To disable root user Type: dsenableroot -d
Type: "su" to Login as root user.

To change how frequently your Mac checks for updates type: defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 12 (change number 2 to how many days you want to lapse between the update checks.
To go back to default type: defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 7

Install Specified Package
softwareupdate -i [package name]

Install Packages Available:
softwareupdate -i -a

Type: dscacheutil -q user | grep -A 3 -B 2 -e uid:\ 5'[0-9][0-9]'

Type: defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock

Type: sudo /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/config/wipeDB

Enable: sudo spctl --master-enable
Disable: sudo spctl --master-disable
Check current status: sudo spctl --status

Type: sudo nano /etc/motd
Then type your message that you want, after that click control + O then hit enter and then click control + x to quit.

To reset and delete message open Finder app, and click “Go” in the menu bar and click “Go to Folder” and type “/etc/motd”.

Make sure to close and reopen terminal for it to take affect.

To check if you have a message already type “cat /etc/motd”.

Get current MAC: ifconfig en0 |grep ether

Spoof your MAC: sudo ifconfig en0 ether (custom MAC) (A MAC address should look like: 5E:6C:A0:C8:DE:7E)
1. Open terminal and type openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'.
2. Disconnect Wi-Fi, and sudo ifconfig en0 ether random address.
3. Connect to Wi-Fi.

Type: sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport "en0" -z

sudo rm -R /Library/Preferences/com.apple.Bluetooth.plist

Type: open -a (name of app)

Type: sudo codesign --force --deep --sign - /Applications/iTunes.app

Public Seed: sudo /System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil enroll PublicSeed

Customer Seed: sudo /System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil enroll CustomerSeed

Developer Seed: sudo /System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil enroll DeveloperSeed

Un-enroll from beta program: sudo /System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil unenroll

See current program Mac is enrolled in: sudo /System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil current

To enable type: sudo nvram StartupMute=%00
To disable type: sudo nvram StartupMute=%01

Hide: defaults write com.apple.systempreferences AttentionPrefBundleIDs 0 ; killall Dock

Show: defaults write com.apple.systempreferences AttentionPrefBundleIDs 1 && killall Dock

Type to shutdown: sudo shutdown -h now

Type to restart: sudo shutdown -r now

1. Press command + S
2. Type commands below when you are able to type.
Type: mount -uw /
Then: rm /var/db/.applesetupdone
Then Type "Reboot" when finished.

1. Type command: pkgutil —expand (drag pkg file) (drag made folder) don't include brackets.
2. Open folder and left click on the pkg file and click show package contents.
3. Find payload file.
4. Then type go to terminal again and type: tar -xvf (drag payload) -C (drag folder that the pkg file is in)
5. Wait till done.
6. Now open the .app file.

If you want to lock a zip for multiple files within a folder type: zip -er (path to new file with .zip extension at the end) (path of original folder)

If you want to lock a zip for a single file type: zip -e (path of new file) (path of original file)

Type: ping -c 10 www.apple.com

Type: Ping "iP" -t -l 40000 
Number can go all the way to “65500”. Higher than that will not work.

FCP type: mv -v ~/Library/Application\ Support/.ffuserdata ~/.Trash
Logic Pro type: mv -v ~/Library/Application\ Support/.lpxuserdata ~/.Trash

"MUST RUN FROM MACOS RECOVERY MODE"
1. Boot Mac into recovery mode.
2. Click utilities in menu bar, and open Terminal
3. Type any command from below.
Enable: csrutil enable
Disable: csrutil disable

Type: cd (drag folder that contains .DS store file); find . -name '.DS_Store' -type f -delete

Type: killall NotificationCenter

Type: chmod 744 ~/path/to/file or /path/to/folder

chmod 744 definition: Sets permissions so that, “Owner / User” can read, write and execute, while “Group” can read but can't write or execute, and “Others” can read but can't write or execute.

Go to Finder, then click GO in menu bar, then click Go to Folder, then type ~/Library/Caches

Increase the Icons Size in Launchpad:
defaults write com.apple.dock springboard-rows -int 4
defaults write com.apple.dock springboard-columns -int 4;killall Dock

Decrease Icons Size in Launchpad:
defaults write com.apple.dock springboard-rows -int 7
defaults write com.apple.dock springboard-columns -int 6;killall Dock

Make sure home-brew is installed, then type/run: brew install speedtest-cli, then type/run: speedtest-cli

mv (drag folder in old location) (drag new folder in new location)

Copy folder: cp -R (drag the folder you want to copy) (drag new location where you want to copy folder too), then run the command.

Move folder: mv (drag folder in old location) (drag new folder in new location)

Get a List All IPSW Files for All iOS Devices from Apple
Command: curl http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStore.woa/wa/com.apple.jingle.appserver.client.MZITunesClientCheck/version | grep ipsw | sort -u | sed 's///g' | sed 's/<\/string>//g' | grep -v protected

Get a list of all iPhone IPSW files from the command line
Command: curl http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStore.woa/wa/com.apple.jingle.appserver.client.MZITunesClientCheck/version | grep ipsw | grep iPhone | sort -u | sed 's///g' | sed 's/<\/string>//g' | grep -v protected

Get a list of only a specific iOS version from Apple:
Command: curl http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStore.woa/wa/com.apple.jingle.appserver.client.MZITunesClientCheck/version | grep ipsw | grep 16.0 | sort -u | sed 's///g' | sed 's/<\/string>//g' | grep -v protected | awk '{$1=$1}1'

shortcuts run ‘[enter shortcut name here]’

Type: rm -rf (drag file/folder)

Copyright © 2024 iConfig Hub. This website is not affiliated with Apple Inc.