Valid
	XHTML 1.1! Valid CSS!
Created 2008-01-26   Modified 2009-04-11
Chelton Evans

../images/apple.jpg Mac Notes home

Shortcuts
Making a dvd
Permissions
Corrupted Keychain 2008-05-28
Parallels Desktop 4.0
Web Server
Installing MySQL on Mac OS X 10.5
ACLs
Mail
Mac Ports
Parallels

Primary point of system failure messages - Console(in Finder Apple+shift+U then scroll) > LOG DATABASE QUERIES > All Messages

Shortcuts

Get to the utility menu
Command + shift + u
Right click Ctrl + click
Eject dvd alt+option or restart > hold mouse button down

howto:mac_hotkeys

control-alt-apple-eject - shutdown when logged in
apple-control-eject - restart
apple-alt-eject - sleep

On Boot

apple-alt-p-r with beep - flush PRAM, do 3 times apple-alt-o-f ppc G4 G5
  reset-nvram
  set-defaults
  reset-all

youtube to save file - apple+alt+a for activity window then largest file

zoom cmd+alt+8 toggle zoom, cmd+alt+"+" in, cmd+alt+"-" out.

Disk Utility

Command + shift + u

Taking an image
Boot OS from external drive.
DVD : Restart > c with Mac OS in optical drive.
Can use firewire to boot using another mac's drive. Restart > t for target mode
Use an Intel processor mac for universal image
Boot OS from an external usb hard drive is convenient
Disk Utility > Verify the disk image (.dmg)
Disk Utility > select the image and scan it
Disk Utility > select image > Restore > source and destination

Ensure enough disk space, for example 60G for 30G image, I was getting an input/output error.

In 10.4.11 I had a failed image restore - so I logged in as admin and performed the restore successfully. So I recommend doing restores as an administrator.

[Not recommended because linking breaks between OS releases] Use Migration Assistant to import previous programs/data. However conflicts with old and new system occur, I recommend always doing a fresh install and not importing user programs. That way you know what you are dealing with!

Encrypting a file/directory

Creating an encrypted volume -
> New Image > choose Save As: e.g. i04, choose Volume Name: e.g. i04, choose Volume Size: eg 500 MB, choose Encryption: 256, choose Image Format: sparse disk image
> Enter password > copy files to mounted fs, unmount when finished.
suggestion - compress files before putting in the volume.

openssl is a command line alternative with more power.

Making a dvd

Copying a dvd
Disk Utility > select cd/dvd child node > New Image > Where: DVD/CD Master produces disk1.cdr.
Disk Utility > Burn > choose .cdr and insert disk

Making a data dvd
Insert blank disk > drop files/folders onto disk > burn

Burn .iso file
Disk Utility > File > Open Disk Image > select iso file
Burn > insert dvd

Permissions

In Linux there is root and all other users. In Mac the Admin is the root and just another user depending on context.
sudo su to access a root shell from admin.
They practice of using sudo for every root command is ridiculous(you must be encouraging weak passwords!).

Do not run accounts in admin (as this is effectively root). If they get your password to an admin account they have full control of the box. Many software problems are caused by running an account as an admin, only use the power when you need it.

Misc

Changing file associations - select file with extension > apple+i > Open with: select application then Change All.

Remote desktop - to change login
select computer > Apple i > edit

Adding a vpn
Apple > System Preferences > VPN Type: PPTP > Create Server Address: **** Account Name: xxx > Authenticate Settings   Password: yyy > OK

Connecting to a Windows 2003 File Server
Finder > Go > Connect to Sever > Server Address: smb:// ip address

File sharing - afp, ftp, smb
System Preferences > Sharing > tick "File Sharing" > select options > choose protocol
eg set up local ftp server - created account dropbox, ticked ftp, created file /Users/Shared/dropbox, installed ftp software on other computers with account to log into dropbox in the /Users/Shared/dropbox directory, changed the permissions of this directory to 777.

Web Server

System Preferences > Sharing > Web Sharing checked

Two ways of putting up files ~/Sites publishes under x.x.x.x/~<user>
/Library/WebServer/Documents
publishes x.x.x.x/.
eg index.html page there.

To see the web pages. http://localhost/   http://localhost/~<user> http://localhost/manual/ for the manual

To enable php - uncommented LoadModule php5_module libexec/apache2/libphp5.so in /etc/apache2/httpd.conf.
To restart the web server with new configuration simply turned off and on the webserver from Web Sharing checked in Sharing.

Symlinks

Created a symlink, then turned on php to follow that symlink. For Mac each user has their own http.conf file eg

File /etc/apache2/users/zero.conf

<Directory "/Users/zero/Sites/">
    Options FollowSymLinks Indexes MultiViews
    AllowOverrride None
    Order allow,deny
    Allow from all
</Directory>

In directory /Users/zero/Sites
ln -s /Users/zero/base/p1/comsci/php php

This created the symlink php.

The drawback to using symlinks this way is the breaking of relative paths. For example I put relative paths into my html to find css style sheets. The advantage of symlinks is that I only need to code in the one place.

Installing MySQL on Mac OS X 10.5

Extracted mysql source to /usr/local/mysql-5.0.51b-osx10.5-x86.
# ln -s /usr/local/mysql-5.0.51b-osx10.5-x86 /usr/local/mysql

Downloaded dstoos from NEW: Directory Dervices account tools for groupadd equivalents.
dsgroupadd mysql
dsuseradd mysql

# cd /usr/local/mysql
# chown -R mysql .
# chgrp -$ mysql .
# scripts/mysql_install_db --user=mysql
# bin/mysqld_safe --user=mysql &

While sql worked at the command line, it failed in the php script served by httpd.
connect]: Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (
So I created two sim links for the job after reading Topic: Can't connect to local MySQL server through socket '/var/mysql/mysql.sock'
# cd /usr/local/mysql
# ln -s /private/tmp/mysql.sock mysql.sock
# ln -s /usr/local/mysql-5.0.51b-osx10.5-x86 /var/mysql

ACLs

Enable on Volume - Workgroup Manager > Sharing > All > General > Enable Access Control Lists on this volume checked

Access Control Lists in Workgroup Manager > Sharing tab. The ACL's override the POSIX permissions.

Mail

mailbfr - fixing mail on server.
backing up mail
mailbfr --backup /Users/admin/backup/ -full
incrementally backing up mail
/usr/sbin/mailbfr -b /Users/admin/backup --mode incremental
Rebuilding database - collateral: all mail is marked as unread
Here is a way to delete a user when the Gui fails to fully do the job. Delete the users mail directory /var/spool/imap/user/fred then do the following
mailbfr -f
mailbfr -o
mailbfr -q

Mail kept crashing - only clue was that users had more imap connections than normal. - problem solved by another: looking at the server config increased the number of IMAP connections[Workgroup Manager > Mail > General ] - he calculated that there were too few for the number of users as one user can logging in generate 5 connections.

$ mailq   to find true mail queue length as Server > Admin > Mail > Mail Queue does not count BC CC.

Look at what is happing in mail server
# tail -f /var/log/mail.log

/etc/imapd.conf
/etc/postfix/main.cf
/etc/postfix/master.cf

Client Mac Mail

Exporting and importing folders
Highlight folder > Mailbox > Archive Mailbox.. > select file
File > Import Mailboxes... > mbox files > select file > ON MY MAC folder drag and drop files

Deleting email cache
Quit Mac Mail
delete /Users/xxx/Library/Application Support/Address Book/MailRecents-v4.abcdmr file.
Log out and log back in again

Keychain Access

Password recovery
In Category select Passwords, scroll through the Names, in the top pane is a detailed description of each password instance.

For example,
192.168.80.1 cheltone imap://192.168.80.1
is my mail

Right click on entry > Copy Password to Clipboard
paste into an editor and see password.

/Users/<user>/Library/Keychains/login.keychain stores the keychains.

lsof -i :22 processes on port 22

CS3

To see how photoshop is handling a large file - - open file > triangle bottom toolbar > Show Efficiency or Scratch sizes

CR2 raw files - open and work with 16-bit tiff in photoshop, then convert to 8-bit tiff for import into Indesign

Permissions

.dmg install broken, works for say admin but not for another account - permissions issue, go to another computer that works zip up their install and copy it across.

Relicience

MS Office - pull out ~/Library/Preferences/Microsoft/Office 2008/Microsoft Office 2008.plist
Drag out, restart office and re licience. /Applications/Office 2008/office.pid - delete

Formatting Drive for Mac OS

Applications > Utilities > Disk Utility
click outermost icon > select Partition > change partition to Partition1 > Mac OS-Extended (Journaled) > Options > GUID Partition Table (Intel) > Apply

Mac Ports

# cd /opt/local/bin/
# .port -d selfupdate
# .port -v selfupdate
# .port upgrade outdated

# ./port install dia
failed with incompatible xcode version. Always need to keep up to date. In this case upgrade mac os.

Alternatively FINK

# apt-get update

Death of programming - how much red tape do we need?
# dscl . append /Groups/<group> GroupMembership <username>
# dscl . append /Groups/_developer GroupMembership zero

to access gdb!

Misc

Mac Ports