Google
 
Showing posts with label Mac. Show all posts
Showing posts with label Mac. Show all posts

12/23/10

Install python packages.

Python provides a easy solution to install packages and resolve package dependencies.


>> sudo easy_install simplejson 

This works very well!!!

5/2/10

lipo in Mac

lipo is very helpful. Look at the following examples.



$ lipo -info /usr/local/lib/libgd.a
input file /usr/local/lib/libgd.a is not a fat file
Non-fat file: /usr/local/lib/libgd.a is architecture: ppc7400

$ lipo -info /usr/lib/libcrypto.dylib
Architectures in the fat file: /usr/lib/libcrypto.dylib are: ppc7400 ppc64 i386 x86_64


How to uninstall Qt on Mac.

If you installed the binary file, do the following:

sudo /Developer/Tools/uninstall-qt.py

4/6/10

dyld: Library not loaded

After I installed qwt, everything seems to work. However, whenever I execute the program (examples), I got into trouble. When I used Qt creator to open one particular example and build it, I encountered the following error: 
dyld: Library not loaded: libqwt.5.dylib
I searched the internet and did not find any easy solution. Proudly I used the following command to fix the problem. It may not be elegant but it works for me.


sudo ln -s /usr/local/qwt-5.2.0/lib/libqwt.5.dylib /usr/lib/libqwt.5.dylib



1/9/10

problem with iwork: keynote quit unexpectedly while using the SFWordProcessing plugin

Solution is here


Symptoms

After updating to Mac OS X v10.6.2, iWeb and iWork applications may quit unexpectedly. On my computer it shows the following:
"keynote quit unexpectedly while using the SFWordProcessing plugin"

Products Affected

Numbers '09, Keynote '09, iWork '09, iWeb '09

Resolution

This issue may be resolved by removing the font database. To do this:
Important: If you use Font Book to manage your fonts, you will need to open Font Book after step 3. Font Book library information will be restored. However, the state of whether fonts are active or disabled will be lost. You will need to correct this manually.
  1. Shut down your computer.
  2. Start up your computer while holding down the Shift key. This starts your computer in Safe Mode and removes the font database.
  3. Restart your computer.
  4. Open the application that quit unexpectedly (iWeb, Keynote, Pages, or Numbers).

10/18/09

compile Qt4.6 on snow leopard.

I had trouble with the binary files, both 4.5 and 4.6Beta. The installer freezes at "validating packages". Finally I decided to compile the source files. The first trial failed with a lot of errors related with tiff files. Then I used the following command and successfully compiled the file.

>> ./configure -qt-libtiff -sdk

>> make

>> sudo make install

So far it seems to work well.

10/15/09

binutils on snow leopard

use the following when config:

>> ./configure --disable-werror

otherwise it won't work.

compile openCV 2.0 on snow leopard

In the command window:


>> CXXFLAGS="-m32"
>>  LDFLAGS="-m32"
>>  ./configure


After that, do the following:


>> make
>> sudo make install (run as root). 



enable root account in Mac (10.6)

The easiest way to enable root is to start a terminal session, and type:

sudo passwd root
You will be prompted for a new password to enable root access.

If it does not work, following next steps:

  1. Open the Directory Utility located in /System/Library/CoreServices/.
  2. Unlock the application by clicking the padlock icon and entering your Administrator login.
  3. From the Edit menu, select Enable Root User.
  4. Chose Change Root Password from the Edit menu and chose a password for the root user.
That’s it! Make sure to lock the application by clicking the padlock icon.

10/7/09

How to Build Up a Bulleted List in Apple Keynote ’09

http://www.ehow.com/how_4929870_build-up-bulleted-list-keynote.html

9/9/09

Mac keynote 2009 format.

he new iWork '09 suite includes a new file format that packs all the data into a single file, rather than using a package bundle, as did iWork '08.


To get the folder, just change the extension of the file from .key to .zip. Then you can just unzip it to a folder. Change back from .zip to .key will give you the intact keynote file. 


To get the old formats back, simply go into Preferences in each iWork application, and under the General tab, check the box that says Save new documents as packages

4/15/09

delete locked files on Mac

Advanced tip about deleting locked files

If there are several locked files in the Trash, you can unlock them all at the same time at the command line. Follow these steps:

  1. Open Terminal. It's located in /Applications/Utilities.

    Type: chflags -R nouchg 
    Note: Type one space (not pictured) after nouchg in the line above, so that it ends in "nouchg ". Do not press Return yet.
  2. Double-click the Trash icon in the Dock to reveal the contents of the Trash. If necessary, arrange the Finder window so that a portion of the Terminal window is still visible.
  3. Press the Command-A key combination to select all files in the Trash.
  4. Drag the files from the Trash to the Terminal window. 
    Note: This automatically enters the pathname for each file. This eliminates the need to individually empty multiple Trash directories, particularly when multiple disks or volumes are present.
  5. Press Return. No special text message will be shown indicating that the command was successful.
  6. Empty the Trash.


If the Trash does not empty or if you see a message in Terminal that says "usage: chflags [-R [-H | -L | -P]] flags file..." you most likely did not type the text in step 2 as indicated or did not leave a space. Repeat the steps if this happens.


originally from: http://support.apple.com/kb/HT1526

1/5/09

Recover old version of Qt on Mac (Tiger)

I have problems with Qt 4.4 on my Mac (tiger) and I posted my questions. But so far no real solution yet. I want to switch back to Qt 4.3.4. But when I used the dmg file to install it, the computer says "there is nothing to install". How can I deal with this?

Navigate to /Library/Receipts, find the Reciept from the last time you used the package installer to install 4.3.4 (back before you had 4.4.0), and delete it/them. Looking at my machine, it looks like there might be several packages named something like Qt_libraries, Qt_docs, etc. The installer should be happy then. No guarantees as to how well this will actually work with the 4.4.0 install though. I THINK it should work.

12/30/08

Mac and ldconfig

In Mac system, there is NO ldconfig which exists in Linux system. The corresponding command in Mac is called "dyld". You can find out more details by "man dyld"

7/4/08

HOWTO: Backup Your Mac With rsync

About This Document

  • Created: 26 January 2005
  • Updated: 18 December 2005: added note for Mac OS X 10.4 and general clean up.
  • Updated: 18 February 2006: added note about using -x switch to reduce need for specified excludes. From suggestion by Mike Bremford.

Author: Matthew Phillips

This document describes how to setup a system for automatically backing up a Mac (OS X 10.2 or later) to an external drive using the freely available rsync utility. This applies to any kind of external drive including FireWire, USB and network drives. It does not apply to CD-R or DVD-R media. It also does not apply if you want to implement an incremental backup system.

External Drive Setup

If you've already set up the external drive you'll be backing up to, you can skip to the next section.

To create a partition on the disk drive, connect the drive and wait for Mac OS X to offer to run Disk Utility to initialise it.

The details of how to use Disk Utility are beyond this HOWTO and are well covered by the Mac's online help: just run help and search for "Partitioning a hard disk".

Below is a screenshot of a partitioned drive in Disk Utility. In this example I've chosen to create two partitions, named OSX and Data, one for backing up the core system and user accounts, and one for large data files such as music and movies. These appear as drives on the desktop and as folders in the /Volumes folder. If you're not sure what you want, just create a single OSX partition.

Disk Utility screenshot

When you've created the partitions, you'll see them appear as empty drives in the Finder and on the Desktop.

Ensuring Ownership Permissions Are Enabled

For some reason Mac OS turns off permissions management for new partitions by default, which will result in "chown" errors from rsync if not rectified.

To enable permissions, select the partition in on the Desktop and show its information page by hitting Command+I. Expand the "Ownership & Permissions" section and make sure that "Ignore ownership on this volume" is not checked as shown below.

Partition info screenshot

Software

Note to users of Mac OS X 10.4 and later: Apple extended the version of rsync shipped with Mac OS X 10.4 to directly support resource forks, so if you don't want to use the GUI provided by rsyncx, you can skip the software installation and go to the Advanced section.

You only need one piece of software to backup your Mac that's not already part of Mac OS: rsyncx. Although Mac OS X comes packaged with bog-standard Unix rsync, rsyncx is needed in order to preserve Mac-specific resource forks. While Apple is no longer recommending applications use resource forks, some classic Mac apps still rely on them. rsyncx also comes with a graphical front end that can make it much easier to get started.

You can download rsyncx from VersionTracker (version 2.1 was current when this document was last updated). More information about rsyncx and its developer, Kevin Boyd, is available here.

To install rsyncx, simply extract the rsyncx archive and find the installer package inside it which will be called something like RsyncX_v2.1.pkg. Double-clicking this will install the rsyncx GUI and the command line program /usr/local/bin/rsync (it will not delete the built-in rsync).

Simple Setup

If you just want to create a backup of your entire Mac hard disk (and optionally make it bootable), then this section is for you. If you want to back up only some of the drive or use multiple partitions, see the Advanced section.

The simplest way to use rsyncx is to use the graphical front end: just select RsyncX from the Applications folder. Below is a screenshot of how to set up the application to back up the entire Mac hard drive to the external drives' OSX partition and make it bootable.

RsyncX screenshot

Tips

  • The "Remove Unmatched" checkbox tells rsyncx to delete any files on the external drive that have been deleted since the last backup. Coupled with Archive mode (which preserves all file modification times, ownerships, etc), this will produce an exact copy of the drive.

    Note: this option will also mean that any files you may have accidentally deleted will also be deleted from the backup too, making it possible to lose a file permanently if you don't notice its deletion in time.

  • Although it's not obvious, you can resize the window by dragging the right corner which displays more than one "Source" path. You can use this to select several specific folders rather than the whole drive.
  • If you're using FileVault to encrypt your home folder, you may want to consider backing up the system from another account. This is because if you run the backup while you are logged in, the backup process will copy your unencrypted home folder's contents.

    The simplest way to do this is to create a special "Backup" user and, when you do a backup, log off from your account and log back in as Backup to run the backup process. This will result in your home folder also being encrypted in the backup (it appears as a single, large, encrypted .sparseimage file). The one downside of doing it this way is that you'll also need to grant the backup user admin rights as described in the advanced section.

    In fact running the backup while logged in as another user can be a good idea even if you're not using FileVault, since it reduces the likelihood that processes will modify files while they're being copied.

Booting From Backup

Obviously the best way to test whether the backup will work in an emergency is to boot from it. To do this, restart the Mac and hold the Option key down while it boots. You will be presented with a screen that allows you to choose the boot drive. If you can successfully boot and login from the external drive, then you can be fairly confident of being able to recover from a disaster by simply booting from backup and using rsync in reverse to restore the system.

Advanced Setup

If you want to do more funky things like backup different parts of the drive to different partitions, exclude certain files from backup or any other sort of customised stuff, then you may want to write some scripts to drive rsync from the command line. This section contains some tips on doing this. It assumes you know Unix-type stuff like vi.

Mac OS X 10.4 users

As of 10.4 Apple's shipping rsync supports resource forks by specifying the -E flag on the command line. The example script allows switching to the OS X built-in rsync by swapping commented definition of RSYNC at the top of the script.

Below is the text of a script called backup.sh that can be used to backup all of the main hard disk, with a specified set of exceptions listed in a file called backup_excludes.txt.

  #!/bin/sh

# To use Apple's rsync switch commented lines below
# To use rsyncx:
RSYNC=/usr/local/bin/rsync --eahfs --showtogo
# To use built-in rsync (OS X 10.4 and later):
# RSYNC=/usr/bin/rsync -E

# sudo runs the backup as root
# --eahfs enables HFS+ mode
# -a turns on archive mode (recursive copy + retain attributes)
# -x don't cross device boundaries (ignore mounted volumes)
# -S handle sparse files efficiently
# --showtogo shows the number of files left to process
# --delete deletes any files that have been deleted locally
# $* expands to any extra command line options you may give

sudo $RSYNC -a -x -S --delete \
--exclude-from backup_excludes.txt $* / /Volumes/OSX/

# make the backup bootable - comment this out if needed

sudo bless -folder /Volumes/OSX/System/Library/CoreServices

You can copy and paste this text into a new new and then execute chmod u+x backup.sh to make it into an executable command.

The file backup_excludes.txt contains a list of files to exclude. An example is shown below — this list can be used as the default set of directories that should not be backed up which you can add to as needed.

/tmp/*
/Network/*
/cores/*
*/.Trash
/afs/*
/automount/*
/private/tmp/*
/private/var/run/*
/private/var/spool/postfix/*
/private/var/vm/*
/Previous Systems.localized
.Spotlight-*/

Tips

  • You can run the backup script with the -n option to test it. In this mode rsync will run through the motions but not make any actual changes. Adding -v will cause rsync to print out all the files it will be changing.
  • If you're running the backup as the "backup" user as recommended in a previous tip, you will need to grant the backup user the ability to run the rsync and bless commands as root. To do this you need to run "sudo visudo" as an admin user and add the lines highlighted in green to make it look like the example below.
    # sudoers file.
    #
    # This file MUST be edited with the 'visudo' command as root.
    #
    # See the sudoers man page for the details on how to write a sudoers file.
    #

    # Host alias specification

    # User alias specification

    # Cmnd alias specification
    Cmnd_Alias BACKUP = /usr/bin/rsync, /usr/local/bin/rsync, /usr/sbin/bless

    # Defaults specification

    # User privilege specification
    root ALL=(ALL) ALL
    %admin ALL=(ALL) ALL
    backup ALL=BACKUP
  • The fact that the command line version of rsyncx has the same name as the built-in rsync carries the danger that you may not be using the right one. The standard rsync that comes with Mac OS X is in /usr/bin/rsync and, since /usr/local/bin is usually used before /usr/bin, the extended rsync should be what you get. If you want to be sure, run "rsync 2>&1 | head -n 3" and if you see "HFS+ filesystem support for OSX (C)2004 Kevin A. Boyd" as the last line, then you're using rsyncx.

4/3/07

How to Open a Program Automatically When a Mac Starts Up

How to Open a Program Automatically When a Mac Starts Up

Rate This Article:
Difficulty: Easy
If you use a particular program or application every time you start up your Mac, here is how to make it launch itself. You can also make a sound play automatically this way.

Instructions

  • STEP 1: Find the application (or sound) icon and click on it.
  • STEP 2: Click on the File menu and select Make Alias.
  • STEP 3: Drag the alias to the desktop where you can get at it.
  • STEP 4: Double-click to open the System Folder and locate the Startup Items folder.
  • STEP 5: Drop the alias into the Startup Items folder. The next time you start up your Mac, the application will launch.


2/28/07

Mac fink installation.

On Mac I installed fink. It is very good. I installed xfig, and latex using fink. However I spent quite a while try to find where those exec files are. It turned out that most of the files are in the folder: /sw/bin/

2/27/07

On Mac use Keynote to prepare big posters.

Setup the page size correctly:

First generate an empty page, then go to the inspector. Select the first tab, then click the slide size drop-down and pick “Custom Slide Size”. Keynote assumes 72 pixels per inch, so multiply your desired poster size by 72 and enter that for the slide size height and width. Personally for my poster (44 inch x 36 inch), the numbers are: (3168x2592).

Note that Keynote will insert a white margin around your poster when you go to print it, so you don’t need to put a border around things when designing your poster. You can put objects right up to the very edge of the slide and they will still print OK.