Tag Archives: Macintosh

Mac – Set NTP time server from command line

Active Directory login, Keyserver access, SafeConnect, etc all require the connecting client to have a time setting that is within 5 minutes or so of the server’s time setting.  It is therefore useful to use a “network time protocol” server to set your local computer’s time to the “correct” time.

Macs typically use “time.apple.com” to set their time from the network.  This is fine most of the time. 😉

In the rare times you want to set a different time server on a Mac, use Terminal and enter the command:

sudo systemsetup -setnetworktimeserver <timeserver>
(replace <timeserver> with the address of the time server 
you want to use as in 137.165.4.21 for Williams College)

Since this is a command run with “sudo”, you’ll be asked to enter the account password and that account needs to be authorized as a “Super User” or “root” user.

By the way – the GUI interface in the “Date & Time” System preference only allows you to choose time servers hosted by Apple.

For more details see the web page at:

http://hints.macworld.com/comment.php?mode=view&cid=98039

 

Mac – Using Install command line to install packages

Some software can not be installed on the master image computer because it needs to be uniquely installed on each clone.  So rather then have to copy packages to each clone after imaging, why not put the packages in a known location and then call the installer remotely using the command like:


installer
-pkg /Users/labadmin/Desktop/post/Sophos_10.mpkg -target /

 

See the complete man page at:

https://developer.apple.com/library/mac/documentation/darwin/reference/manpages/man8/installer.8.html

Mac – Apple Remote Desktop Hangs – Kill the process

Sometimes Apple Remote Desktop hangs on the remote computer and/or you get disconnected.  When that happens you can get the message “can not control remote computer because it is running Apple Remote Desktop or another administrative application”.  To “fix” this …

With ARD on the local computer, Send the Unix command:

ps -A

This will a list of processes which are running on the remote computer.  Find the process number, the PID, for the Apple Remote Desktop application process and then give the command (send a unix command):  kill -KILL “PID#”  (change “PID#” to the actual pid #)

WARNING – the kill -KILL command is not kind.  It will stop any process without additional double check and, therefore, if you kill the wrong PID you can cause the system to halt and become completely unresponsive.

as in:

kill -KILL 25204

Mac – Removing printers with command line

I use lpadmin -x to remove printers when needed as in:

lpadmin -x Spencer-116-Color

lpadmin can be used for a bunch of other chores.  See:

https://developer.apple.com/library/mac/documentation/Darwin/Reference/Manpages/man8/lpadmin.8.html

Interestingly, the -x option isn’t listed in the man page!

See also: http://hints.macworld.com/article.php?story=20061203221317612 For additional options like clearing queues …

 

Mac – Mt Lion – Disable Notification Center

With Mt Lion, Apple introduced a unified notification center application that alerts you to a number of things like email, etc.  Unfortunately, it also alerts you to recommended system updates. All of this is unwanted on lab/classroom computers.

I have found that the best way to stop the notification center is to hide the application were it lives.  To hide things on Mac OS X, just like in unix, rename them to something that starts with a “.”  Therefore, in /System/Library/CoreServices rename  NotificationCenter.app to .NotificationCenter.app

This command may do the trick ….

sudo mv /System/Library/CoreServices/NotificationCenter.app /System/Library/CoreServices/.NotificationCenter.app

 

Mac – Turn wireless on or off via command line

To control the network settings with the command line try:

networksetup -listnetworkserviceorder

Then:

To display current state of wireless:

networksetup -getairportpower <device name>

Or to turn wireless off or on:

networksetup -setairportpower <device name> <on off>

For a longer description of these see:

http://reviews.cnet.com/8301-13727_7-57566448-263/how-to-adjust-network-settings-in-os-x-via-the-command-line/

Software – VectorWorks nethasp.ini network license file locations

For VectorWorks we use a “dongle” attached to a network license server.  To configure this on the clients use the “nethasp.ini” file pointed to our license server. That file needs to live in /etc on Macs and in the program directory on windows.  For more information see:

http://kbase.vectorworks.net/questions/469/NetHASP.ini+Configuration+Guide

Mac – Startup – GUI to create and edit plist startup files for launchdeamons

Using Lingo version 2.1.1 I am able to use a GUI to create a plist file to allow something to run at a specified time on a Mac.  I tested this on Mac OS 10.8.4 to great a plist file to run at startup to set the screen resolution with cscreen.  It worked great.  You do have to lower the security preferences to allow applications from anywhere to allow Lingo to run.  There is a newer version of this available from the app store which my be worth the money …

With FileEventer I can watch where the plist file gets saved.  In my case test, setting screen resolution with the application cscreen at boot time, the plist file was saved to:

/Library/LaunchDeamons

I was then able to copy the saved plist file to other macs.

See the longish blog posting on this at:

http://blog.aitrus.com/2012/12/20/a-gui-utility-to-view-edit-agents-daemons-for-os-x-peter-borgs-lingon/