OS X tricks

home | blog | Teh Internet | guest blog |rants | placeholder | political | projects | Gwen and Liam | Citadel patched | Tools | Scouts


- Careful Chrome users, this search box might be "Not secure"




Upgraded to El Capitan and now have a black screen on boot?
If zap pram etc - other rubber chicken stuff does not work -
Remove the login plist:
/Library/Preferences/com.apple.loginwindow.plist


Do you have an OS X install that keeps renaming itself? line Does configd rename the system with increasing numbers like:
  configd setting hostname to "hostname-6.local"

You might have named your iOtherDevice to the same name as your desktop!
To fix from the command line, give this a try - i.e. rename the desktop:

Want to change the hostname and have it stick?
Even though we have the hostname command, you need more:
 scutil --set HostName name-of-host
 scutil --set ComputerName name-of-host
 scutil --set LocaHostName name-of-host

man hostname for that one.

Check / renew dhcp lease:
Change out the en0 for whatever interface you are going for:

echo "add State:/Network/Interface/en0/RefreshConfiguration temporary" | sudo scutil

Check it with:
ipconfig getpacket en0

Found that one here: http://osxdaily.com/2013/02/11/renew-dhcp-lease-mac-os-x/

Get the serial number of that machine:
system_profiler SPHardwareDataType | grep Serial

Found that one here: http://osxdaily.com/2011/04/25/get-mac-serial-number-command-line/

Determine which WiFi AP you are on:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I

Other networking items:
Get the hardware inventory - available for networking - Ethernet, Thunderbolt etc:
 networksetup -listallhardwareports

Run it without flags to get full help output.


Find what software updates are available:
softwareupdate --list

To just accept and install all of them:
softwareupdate -i -a

Or just skip checking for them - (not that you would do this in real life):
softwareupdate --schedule off

Run it without flags to get the full help output.


To get an external disk to show up for Time Machine:
 defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1



What version of the OS is running (not kernel version)
sw_version


How to bat clean up on OS X Server 10.9 while adding many users (bogs down):
Looks like processes are spawned for each user added.  If you are a school, and adding many students, you might
want to pull your hair out.  Or, you might just give this script a try (warning, only tested in 1 environment), you will
need to make tweaks for your own and or test on a test environment with no live user data first!:

Our users have the pattern of [0-9][0-9] at the end of the login name, so you will need to change the regex
at a minimum:

iconservices-fix.py

Clean up from "Reopen Windows When Logging Back In":
rm /Users/*/Library/Preferences/ByHost/com.apple.loginwindow.*
killall cfprefsd

Probably make it a starup script (login script) as mentioned here:
http://osxdaily.com/2011/08/25/disable-reopen-windows-when-logging-back-in-in-mac-os-x-lion-completely/



Hide a user from the simple login screen:
Thanks OS X Daily http://osxdaily.com/2015/02/01/hide-specific-user-account-mac-os-x/
And as always, here is the info, in case the link above breaks.
sudo dscl . create /Users/usertohide IsHidden 1


Remove old Profile Manager crap -
Thanks Kryped.com - Charles Edge - http://krypted.com/mac-os-x/gist-to-fully-reset-profile-manager/
In case that link breaks, here it is... (Careful, the script below will break things). Don't use if you don't know what I am talking about!:
#/bin/bash
#very dangerous as it unrecoverably removes all profilemanager data
sudo /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/wipeDB.sh
sudo serveradmin stop devicemgr
sudo serverctl disable service=com.apple.DeviceManagement.postgres
sudo rm -R /Library/Server/ProfileManager/Config/ServiceData/Data/backup
sudo rm -R /Library/Server/ProfileManager/Config/ServiceData/Data/PostgreSQL
sudo /Applications/Server.app/Contents/ServerRoot/System/Library/ServerSetup/CommonExtras/80-devicemgrcommon.sh


Set a wake up schedule for the machine:
(wake up every day at 1 am):

pmset repeat wakeorpoweron 01:00:00 MTWRFSU

Check it with:
pmset -g sched


Not really a trick, but rather a bad UI design (vlans):
The gear under the interfaces has vlan management!



[æ]