Spengster.com Tutorials/Information

December 15, 2018

I have spent countless hours searching the net and picking my colleagues' brains for various bits of hard-to-find information over the years.
Now I decided that it would be a good idea to organize all of this knowledge in a central location for my befenit as well as for the benefit of others.

Table of contents:
Email me at help_AT_spengster.com for more info or clarifications.

"-shared" flag on Mac OS X gcc   [top]

Problem: gcc on Mac OS X 10.3 does not allow the use of the "-shared" flag to generate shared libraries.
Solution: replace "-shared" with "-bundle -undefined suppress -flat_namespace"
NFS shares on Mac OS X 10.3   [top]

Problem: You want to share directories on your machine through NSF, or you want to connect to NFS shares on remote machines.
Solution: This is fairly simple, but too me a while to understand. You can use nidump and niload to read and write info from your NetInfo database.
For example, suppose you want to share directories /exports and /Volumes/Data on your machine (myhost.com). Create a new file (I will use "exports.txt"), and put the following in it:
{ "name" = ( "exports" ); CHILDREN = ( { "clients" = ( "" ); "name" = ( "/Volumes/Data" ); "opts" = ( "maproot=root" ); }, { "clients" = ( "" ); "name" = ( "/exports" ); "opts" = ( "maproot=root" ); } ) }
This file is in NetInfo "raw" format. The format does not allow for any comments. Now run
niload -r /exports . < exports.txt
(you will have to run it as root or with sudo)
That's it for your host.

On a client machine, put the following in a file (I use "mounts.txt"):
{ "name" = ( "mounts" ); CHILDREN = ( { "name" = ( "myhost.com:/Volumes/Data" ); "dir" = ( "/mounts/data1" ); "opts" = ( "-c", "-b" ); "vfstype" = ( "nfs" ); }, { "name" = ( "myhost.com:/exports" ); "dir" = ( "/mounts/exports" ); "opts" = ( "-c", "-b", "net" ); "vfstype" = ( "nfs" ); } ) }
Some explanation is warranted here - this is a work in progress...
LDAP server on OS X 10.3 non-server edition   [top]

To start/stop the built in LDAP server, run
/System/Library/StartupItems/LDAP/LDAP start [stop]

I will post more information here when I finish massaging my setup to work the way I want it to.
How to change the default 100 processes limit that is imposed by Mac OS X 10.3   [top]

This guy seems to have the defacto solution to this problem:
http://ruminate.net/pdm/mt/os%20x%20tips/a_solution_for_mac_os_x_103_process_limits.html
A simple command to change the user and group ids of files   [top]

I have found this when searching the web on some forum site, which I no longer remember. This is a simple unix command, and pretty self explanitory:

Note: you must run these commands as root: either logged in as root (su -) or with sudo.

Change uids:

find / -xdev -user 501 -exec chown 506 {} \;

Change gids:

find / -xdev -group 501 -exec chgrp 506 {} \;

Some notes:
  • 501 is the old user id, and 506 is the new user id. Same for the group ids. The uid and gid don't have to be the same, but for me they are.
  • The -xdev flag tells find to ignore the /dev directory.
  • The "/" after "find" indicates where to start looking (files/directories will be found recursively from here. man find for more info). "/" means start at the root of the filesystem.