OSes‎ > ‎

MacOSX

MacOSX Tips

I inherited MacOS X Panther Laptop (PowerBook G4 1.25 Ghz). MacOS X is a hybrid of Mach, BSD and NextStep. It is very closeto UNIX with differences and thus it becomes pain. I was surprized to find the sloppiness in Apple tools and Fink tools.

Index


How can I get the system info?

Menu → Go → Application → Utilities → System Profiler.

Top


How can I install unix software?

If you ever tried to compile unix software on MacOSX, you get irritated by the small differences MacOSX has. Fortunately, Fink project http://fink.sourceforge.net does all the work for you and installationis a snap if you have a fast internet connection. You first install Fink software from http://fink.sourceforge.net/download/index.php?phpLang=en. Note that the software is installed in /sw.


  Ask fink whether "package" is available or not.  
  $ /sw/bin/fink list package
  If you want to install "package"  
  $ sudo /sw/bin/fink install package
  
For example,

  $ /sw/bin/fink list blt  
  Information about 1498 packages read in 1 seconds  
  i  blt         2.4z-2          
  Toolkit for tcl/tk     blt-dev     2.4z-2          
  Toolkit for tcl/tk  i  blt-shlibs  2.4z-2          
  Toolkit for tcl/tk
  

The "i" indicates the package is installed. Sometimes the package is designated unstable. Then you cannot install it in this way. You should look up FAQ at FAQ 5.8

Top


Why can't I see /usr etc. in Finder?

Apple wants to hide these unix directories(/.hidden file shows/usr, /etc, /dev etc). In order to make Finder show these files, you do

  
  $ defaults write com.apple.Finder AppleShowAllFiles YES
  

You can find all options of Finder by doing the following:

  
  $ defaults read com.apple.Finder{    
  AlwaysOpenWindowsInColumnView = 0;    
  AppleShowAllFiles = YES;    
  BurnProgressWindowLocation = "411, 164";    
  ComputerOptions = {        
  ComputerBackgroundType = DefB;        
  ComputerIconViewArrangeBy = dnam;        
  ComputerIconViewIconSize = 64;        
  ComputerIconViewScrollPosition = {h = 0; v = 0; };        
  ComputerListViewColumnFlags = 1;        
  ComputerScrollPosition = {h = 0; v = 0; };        
  ComputerSidebarWidth = 128;        
  ComputerToolbarVisible = 1;        
  ComputerUseCustomIconViewOptions = 1;        
  ComputerUseCustomListViewOptions = 1;        
  ComputerViewStyle = icnv;        
  ComputerWindowBounds = {bottom = 0; left = 0; right = 0; top = 0; };    };    
  ContentIndexingLanguages = {   ...
  

Top


How can I compile OpenGL programs?

Apple has two graphics systems, Aqua and X11. The X11 is not installedas default. You have to use Mac OSX disk3 CD and find the X11User.pkg Package in the Package folder and X11SDK.pkg in /Developer Tools/Packages of the XcodeTools CD.. The X11SDK contains header files and libraries for compiling a X11 programs.

If you want to use AQUA, then you have to use the Apple framework:

  
  $(CC) -o $@ $< -framework OpenGL -framework GLUT -lobjc
  

Note that the resulting binary is the AQUA version and thus you cannot use it to run remotely on the X11 system.

On the other hand, if you want to use the X11 version of OpenGL, configure script istricky. Usually configure script uses to locate the X11 header files. Apple gcc compiles fine without specifying X11 directory and thus X_CFLAGS is not set. Unfortunately, X11 version of GL/gl.h and GL/glu.h lives in /usr/X11R6/include. Applegcc won't find these OpenGL header files.

Top


How can I start items in StartupItems after boot?

In RedHat, you have many scripts for services in /etc/init.d. You can startany of the services in that directory by

  
  root> /sbin/service ypbind start
  

I'm trying to find a similar things. So far, I failed to come up with the way.If you find a way, please send me email.

MacOSX has /sbin/SystemStarter which does the similar thing for various things in /System/Library/StartupItems. Thus I tried the following:

  
  $ sudo SystemStarter -v start NIS
  

Note that SystemStarter is a compiled binary file, not script.However, this does not start NIS.

Top


How can I set up NIS

Item 7-10 are specific to my work place.

  1. Goto www.bresink.de/osx/nis.html and read.
  2. Edit /etc/hostconfig file. Modify NISDOMAIN=-NO- to some valid address.
  3. Finder &rarr Application &rarr Utilities &rarr Directory Access BSD Flat File and NIS is enabled (or do Apply). Select this one and press Configure. Add NIS servers in the dialog box.
  4. $ sudo domainname mydomain
  5. $ sudo ypbind
    if the prompt does not come back, "sudo ypbind -d" to see the debug statement.
  6. $ ypwhich
    should show the current server.
  7. create /autofs/{links, space, homes}(ypserver has /etc/automaster in the following way:
    yp:auto.space intr,rw,hard,nodev,rsize=8192,wsize=8192
    yp:auto.links intr,rw,hard,nodev
    yp:auto.homes intr,rw,hard,nodev,rsize=8192,wsize=8192
  8. edit /System/Library/StartupItems/NFS/NFS and comment out all automountlines and add
    automount -l -m /Network/Servers -fstab -m /automount -static
  9. reboot
  10. ln -s /autofs/links/2/space /space
    ln -s /autofs/links/2/homes /homes

Top


Where is the missing crt1.o and dylib1.o?

After running OSX CD3 and CD4, gcc cannot find crt1.o, even though crt2.o exists in /usr/lib/gcc/darwin/3.3. You can find them in /Developer/SDKs/MacOSX10.3.0.sdk/usr/lib.

Top


Are there any free user tools?

Several tools are available at www.bresink.de/osx/. TinkerTool, TemperatureMonitor, PrefEdit are all free.

Top


What should I do for the error:
ld: common symbols not allowed with MH_DYLIB output format with the -multi_module option?

This means that you have a global variable in the library which has not been initialized.Find the complaining variable and get it initialized.

Top


Why Makefile is not created by configure?

After I did configure, I found that no Makefile was created for the library directory,even though Makefile.in is present. If you run automake -v, you find thefollowing error:


  automake: refusing to override the user definition of:
  AR (User, where = aclocal.m4:570) =  
  {    
    TRUE => @AR@  
  }automake: 
  with `TRUE' => `ar'
  

A quick fix is to comment out aclocal.m4 line 570


  # AC_CHECK_TOOL(AR, ar, false)
  

Top


Why is it that L2 cache is not enabled?

I was so surprized to find that in System Preference → Other → Processor, L2 cache was off.I tried to set it to 512 Kbyte in vain. (Every time I close and reopen it was off.)It turned out that this was the real bug. Download the latest CHUD tool from http://developer.apple.com/tools/perfornace/ and your problem is solved.

Top


How can I recover 'Inactive' system memory?

When I use the Activity Monitor, I see "Inactive" system memory grew and "Free" memory remaining very small. My question was how I can recover "Inactive" system memory. I googled and I found the following: http://forums.macosxhints.com/archive/index.php/t-19214.

  
  du -sx / >& /dev/null
  

This did removed most of the "Inactive" memory to "Free" memory. The explanation given in the above web page is: it is observable, and repeatable. one can also observe the 'effect' during the locate database update, which is just a large 'find everything', which exhibits the same cause/effect behavior: sustained disk reads peel some qualifying inactive pages off to the free list.

Top


Why does 'top' use so much CPU?

Use the top with the option -FR. CPU usage is reduced < 2% as Linux does.

   
  $ top -FR

Well, MacOSX is not the standard unix. Here is the blurb from the Mac man page:


  -F     Do not calculate statistics on shared libraries, also  known  as
         frameworks.   This substantially reduces the amount of processor
		 time top consumes.       
  -R     Do  not  traverse and report the memory object map for each pro-
         cess.  This substantially reduces the amount of  processor  time
		 top consumes.
  

Top

Home


updated on August 14th, 2004