User Tools

Site Tools


computers:mac_basic_setup

Mac Basic Setup

Applications

Basic

Optional

  • Perltidy: utility to tidy up perl codes
  • Wget: command-line utility to fetch files
  • R: software environment for statistical computing and graphics
  • VLC: media player.

System Preferences

  • Energy Saver: Computer sleep = never, Display sleep = 10 min, shutdown when UPS battery level is below 20%, enable start up automatically after a power failure.
  • Print & Fax: add lab printer
  • Network: set up lab intranet using DHCP. If using a desktop with ethernet connect, turn off Wi-Fi
  • Bluetooth: off (unless wireless keyboard/mouse is used)
  • Sharing: set Computer Name, enable File Sharing and Remote Login
  • Accounts: disable Automatic login, display login window as Name and password, enable Show input menu in login window

Backup

  • Assign one external hard drive for each mac workstation as the Time Machine backup drive.

Network

  • Use Terminal, type networksetup -listallnetworkservices to see the list of network services
    • e.g., Ethernet and Wi-Fi
  • IPv6; often cause problems
    • to disable: sudo networksetup -setv6off Ethernet and/or sudo networksetup -setv6off Wi-Fi
    • to enable: sudo networksetup -setv6automatic Ethernet and/or sudo networksetup -setv6automatic Wi-Fi

xcode

# Mac OS X 10.9.4
xcode-select --install

Extended Attributes

Some files may have extended attributes, for example:

chkuo@mesquite[~]$ ls -l
-rwxr-xr-x@   1 chkuo  staff   3454 Jan 22 11:11 file1*
-rwxr-xr-x    1 chkuo  staff   2628 Nov  2  2006 file2*

The @ symbol after the permission info of file1 indicates that there are extended attributes. To find out more details:

chkuo@mesquite[~]$ ls -@l *
-rwxr-xr-x@   1 chkuo  staff   3454 Jan 22 11:11 file1*
	com.apple.FinderInfo	  32 
	com.apple.TextEncoding	  15 
-rwxr-xr-x    1 chkuo  staff   2628 Nov  2  2006 file2*

To get rid of these extended attributes:

chkuo@mesquite[~]$ xattr -d com.apple.FinderInfo file1
chkuo@mesquite[~]$ xattr -d com.apple.TextEncoding file1

Newline characters

Mac OS X and Unix uses different characters to denote newline break. This can cause problem when you need to manipulate files in Finder and Terminal. To convert between the two, use:

#!/bin/sh
# change linefeed from unix to mac
for x
do 
  echo "$x"
  tr '\012' '\015' < "$x" > "tmp.$x"
  mv "tmp.$x" "$x"
done

Or:

#!/bin/sh
# change linefeed from mac to unix
for x
do 
  echo "$x"
  tr '\015' '\012' < "$x" > "tmp.$x"
  mv "tmp.$x" "$x"
done

Job scheduling

In addition to the use of crontab for reoccurring jobs, you can also use the at utility to schedule a job to run at a pre-determined time. By default, this utility is disabled due to power management issue (need to read hard drive every minute). This is more of a problem for laptops, but not so for servers (or desktops that are being used as servers). To turn it on, use the command:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.atrun.plist

To turn it off again, use:

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.atrun.plist

To check if the at utility is disabled or not, check preference file to see if Disabled is specified:

cat /System/Library/LaunchDaemons/com.apple.atrun.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.apple.atrun</string>
    <key>ProgramArguments</key>
    <array>
	    <string>/usr/libexec/atrun</string>
    </array>
    <key>StartInterval</key>
    <integer>30</integer>
    <key>Disabled</key>
    <true/>
</dict>
</plist>

For more details, read http://www.macosxhints.com/article.php?story=20050921214411382

Maintenance

Check Time Stamps

Check when the maintenance scripts were run:

ls -al /var/log/*.out

Output should look like this:

chkuo@mesquite[~]$ ls -al /var/log/*.out
-rw-r--r--  1 root  wheel  91407 Jun 18 10:39 /var/log/daily.out
-rw-r--r--  1 root  wheel     84 Jun 18 10:58 /var/log/monthly.out
-rw-r--r--  1 root  wheel   3625 Jun 18 10:57 /var/log/weekly.out

Manual Execution

In case the computer was shut down when the scripts were scheduled to run.

sudo periodic daily
sudo periodic weekly
sudo periodic monthly

Or, to run all three at once:

sudo periodic daily weekly monthly

More Info

Troubleshooting

computers/mac_basic_setup.txt · Last modified: 2020/08/07 12:40 by chkuo