Top Ten Mac OS X Tips for Unix Geeks
Pages: 1, 2
5. Different Kinds of Hidden Files
As with other Unix flavors, you can make a file invisible by prefixing its name with a ., as in /.vol. This has the effect of making it invisible in the Finder, as well as when you issue an ls without the -a option.
Mac OS X also uses a file in the root directory (.hidden) to maintain a list of files that should be hidden from the Finder.
Also, HFS+ (the filesystem used by Mac OS) files and directories can have a hidden attribute set using the SetFile command, as in SetFile -a V SomeFile. (The SetFile command is available in /Developer/Tools after you install the Mac OS X Developer Tools package described in the sidebar.) This setting won't take effect until you relaunch the Finder. You can log out and log in again or use the Force Quit option from the Apple menu. You can turn off the invisible bit with SetFile -a v SomeFile. See the manpage for SetFile for more details. (Note that invisible files are only invisible from the Finder; you can still see them with ls.)
6. Aliases and Links
There are two ways to create links to files. The first is to select the file in the Finder, and drag it to a new location while holding down the Option and Command keys (or select Make Alias from the File menu). This creates a Mac OS alias that Cocoa, Carbon, and Classic applications can follow. However, Unix applications will ignore those links, seeing them as zero-byte files.
You can also create a link with ln or ln -s. If you use this kind of link, Unix, Cocoa, Carbon, and Classic applications will happily follow it.
7. X11
Mac OS X does not come with the X Window System. For native applications, it uses an advanced graphics system called Aqua. But if you want to run X11 applications, you're in luck: Apple has its own X11 implementation with nice Aqua integration, and there is an installer for it on your Mac OS X installation CD-ROM or DVD. If it wasn't installed by default, run the Optional Installs package on your install disc. You'll be able to run X11 applications side-by-side with Mac OS X applications, and they'll look great.
8. Fink
Are there some Unix or Linux applications that you're missing? Check out the Fink project, which modifies open source applications so they'll compile and run on Mac OS X. Fink already includes an impressive array of applications, and more are on the way.
|
Related Reading Mac OS X for Unix Geeks |
9. /etc is Not Always in Charge
If you've come to Mac OS X from another Unix, you may expect that you can add users and groups to the /etc/passwd and /etc/group files. By default, Mac OS X only uses these file in single-user mode. If you want to add a user or group, it will need to go into the Directory Services database, a repository of local directory information. For more information, see this ADC article,Open Directory and the dscl Tool.
10. Shutdown Doesn't Really
For a long time, Mac OS X couldn't execute custom actions at shutdown. The SystemStarter framework (which predates launchd) can perform custom shutdown actions when the system is shutting down. For more information, see "Start Me Up: Writing and Understanding OS X StartupItems" (the ADC launchd article mentions that services that need an explicit shutdown procedure will need the old SystemStarter framework).
In September 2002, O'Reilly Media released Mac OS X for Unix Geeks.
Brian Jepson is an O'Reilly editor, programmer, and co-author of Mac OS X Panther for Unix Geeks and Learning Unix for Mac OS X Panther. He's also a volunteer system administrator and all-around geek for AS220, a non-profit arts center in Providence, Rhode Island. AS220 gives Rhode Island artists uncensored and unjuried forums for their work. These forums include galleries, performance space, and publications. Brian sees to it that technology, especially free software, supports that mission. You can follow Brian's blog here.
Return to MacDevCenter.com.
You must be logged in to the O'Reilly Network to post a talkback.
Showing messages 1 through 37 of 37.
-
Shameless Plug
2008-05-07 23:15:19 BlkDragon96 [Reply | View]
Have to throw in my 2 cents, which happens to be a shameless plug for Blacktree's Visor. And excellent way to adapt to the OS X environment without having the all too necessary shell in the way. (Plus its made by the same people as Quicksilver, so its got to be good.) http://code.google.com/p/blacktree-visor/
-
Shameless Plug
2008-05-07 23:15:06 BlkDragon96 [Reply | View]
Have to throw in my 2 cents, which happens to be a shameless plug for Blacktree's Visor. And excellent way to adapt to the OS X environment without having the all too necessary shell in the way. (Plus its made by the same people as Quicksilver, so its got to be good.)
-
MacPorts packages
2007-05-27 22:46:45 jyrkiwahlstedt [Reply | View]
In addition to Fink, one can use MacPorts (http://www.macports.org) to build open source software on OS X. MacPorts is related to ports command on FreeBSD.
There are some software packages there not available at Fink, check it out.
-
X11 on OSX
2007-05-19 18:46:34 interprocess [Reply | View]
X11 on OSX is limited to displaying X11 apps. Apple's "improved" things like wish so that you can't remotely display scripts!
/cores is a real directory, not a symlink into /private like /etc, /tmp and /var.
Roger
-
-rsrc
2005-05-09 14:05:38 rlrueter [Reply | View]
I copied my hard drive to an external with ditto and did not use -rsrc
Now my quicken data files have been split into a folder containing the resource forks of the old files.
Can anyone tell me how to put it back together?
-
Trouble getting startup service to work
2005-04-26 22:49:39 ed_ruder [Reply | View]
When I try to run a service I've set up as in #3 above (
sudo SystemStarter start Foo), I get the following error:
Welcome to Macintosh.
Unknown service: SnipSnap
Hangup
I realize that there are probably a million things that can go wrong, but does anyone have any experience with this error message? Is there a log file I can examine, or logging I can turn on, to try to figure out what's failing?
Thanks.
Ed
-
Oracle
2005-01-28 13:31:30 jdacosta [Reply | View]
I am considering purchasing a mac to do learn unix and do study for oracle certification.
Do you know if Oracle Database will run on the OS X platform. I know 10g is certified to run on OS X Server, but I am trying to figure out if Oracle will run, I am not concerned too much about guaranteed uptime or performance since it is only for education.
Also if it will / will not run, what components are required, or are missing which prevent it from starting up.
-
Laptops are Useless for Unix?
2005-01-22 15:24:15 lightandshadow [Reply | View]
Last time I checked, Unix was an operating system, not a keyboard layout.
-
will not spend $1 for the book.
2003-10-09 15:59:33 anonymous2 [Reply | View]
Terminology and tutorials are "allover" the writer doesnt see things the way a person that doesnt know would want ti see. He explains as if he's discussing it with his programmer buddies at work.
would rate 2 on 1-10 scale.
May be want to check how Chris is using his teaching skills.
you'll end up reading the book by yourself.
Ciao
-
Cool Article
2003-06-12 13:34:30 anonymous2 [Reply | View]
Maybe I just have an un-natural nack for the Command Line. I have been a UNIX and Mac user almost my whole life, I did not find it particularly difficult to find my way around, granted a few things like the StartupItems instead of the presented a challenge they were easily conquered. I think your article is great in the sense of "I didn't have to search so hard if I had your article handy".
My only OS X quam is the speed (or lack there of ) of their terminal and others like it (I don't want to start X11 everytime I want a terminal).
About the keyboard....dude get over it or get a DELL, no use in deluging others with a mindless rant. I understand you want to make a pooint, but realize this..there is no point in making a point.
|Seraph|
-
Emacs: Meta-Control, how to do it in Terminal?
2003-02-14 05:26:37 anonymous2 [Reply | View]
There are some Emacs keybord shortcuts, such as ESC C-c for exit-recursive-edit, that seem impossible to do in Terminal from the Mac keyboard. I use ctrl-option for the meta or ESC key, but just pressing these keys and releasing them doesn't do anything, so pressing ctrl-C afterwards is just ctrl-C, not ESC C-c. How to handle this?
-
Some minor omissions
2003-02-11 15:05:36 anonymous2 [Reply | View]
1) In chapter 8, the section on fs_usage (pg 132) refers to a figure that was left out of the book.
2) In chapter 3, the section on niload (pg 52-53) does not describe the -r option.
3) In chapter 3, Table 3-1 describing NetInfo commands (pg 49) does not include niutil.
-
vi keybindings for tcsh
2003-02-04 15:58:31 anonymous2 [Reply | View]
Couldn't live without bindkey -v in my .tcshrc. Whew! Now if BBEdit would just get vi-style key binding's we'd be all set.
-
I bought the book and have a question...
2003-01-02 09:12:15 anonymous2 [Reply | View]
In the book it describes how to install X and run vncserver for X Windows. That is great for X Windows applications but what about Mac OS X applications?
I was hoping that the book would explain how to setup the Mac OS X VNC Server to automatically startup so that I can remotely access my Mac OS X applications without having to run the program by hand every time the system changes users or is rebooted.
Or better yet. I was hoping that the book would explain how to attach a new process to another window server. Like you could do with NeXTSTEP and OpenStep. That way Mac OS X would really be for UNIX geeks.
Thanks,
Jason
-
Item #2
2002-11-24 18:46:15 anonymous2 [Reply | View]
Actually, you can sudo -s to get a shell with root privs. I typically use sudo -s -H.
Also, sudo -k will kill your timestamp, requiring you to enter your password the next time you try a sudo command.
sudo is almost infinitely flexible. Changes to the behavior of sudo can be affected through the /etc/sudoers file.
-
StartupItems HOW-TO Article
2002-11-16 10:52:18 timct [Reply | View]
For those that want more detailed information on how StartupItems and SystemStarter work, you can find a great HOW TO on Apple's opensource website:
http://www.opensource.apple.com/projects/documentation/howto/html/SystemStarter_HOWTO.html
-
Great Story
2002-11-03 04:39:39 anonymous2 [Reply | View]
Great Story there.. As a UNIX Admin, it took me month to learn what you've outlined in one page..
Congratulations and good luck with the book!
-
Copying Files
2002-11-02 12:18:09 anonymous2 [Reply | View]
Note that the Mac uses an other filessystem, HFS+ (Mac OS Extended), which follows the older HFS (Mac OS Standard).
As noted in the text, this file systems also keeps track of some file properties like the hidden flag. However, if you use "cp" for copying files, this data will not be copied. In order to also copy this HFS information, you need to use the command "CpMac", which comes with the developper package.
In particular, I've found this useful when copying application. Apple has implemented applications as special folders. When I use "cp -r" to copy an app, I end up with something that the Finder regards as a folder. When I use "CpMac -r", the Finder will recognize it as an application.
-
Re: Apple Laptop Keyboards Unsuitable for Unix Users
2002-10-29 10:02:35 anonymous2 [Reply | View]
Use 'dumpkeys' to dump the keymap out to a file. Then edit the file and switch the scancodes of CapsLock = X, and Control = Y around. Then use the program 'loadkeys' to load that keymap back into mem. This will put the keys back into the right places.
<this is what I did with my iBook2, it works fine, and yes, the battery life is great.>
For a 'UNIX user', you should know by now that the magic is in the software. The hardware is secondary.
cheers!
-
Aliases & Links
2002-10-28 15:38:42 anonymous2 [Reply | View]
Your item on these doesn't really explain the point of aliases - on the face of it one might wonder why one would want to use them when Symbolic links appear to work everywhere that an alias works, but aliases don't work in the bsd environment.
The point is that aliases keep working when the file that they point to gets moved or renamed. They are also smart enough to (attempt to) mount an offline volume if their target file is on it. They have been around in the MacOS world for some time, and have proved to be very useful!
-
Re: Apple Laptop Keyboards Unsuitable for Unix Users
2002-10-27 10:26:29 anonymous2 [Reply | View]
This guy is an idiot. He keeps posting this message all over the place, even though no one cares about his personal crusade. Can't he be banned?
For the record, I've been using Unix for 15 years, MacOS for 12, an Apple laptop for four, and OS X on that machine since it came out, and I am having no problems at all as a Unix user using an Apple laptop keyboard.
So get off it, buddy, the world doesn't revolve around you. And thank you Apple for not catering to bozos like this.
-
Cashcow
2002-10-26 12:51:22 anonymous2 [Reply | View]
So, you gave us the top ten list for free so that you could advertise this on Slashdot and make your book a good cashcow... Do you really think we're that stupid? Reality check guys.
-
alternative to fink
2002-10-26 09:00:18 anonymous2 [Reply | View]
For those who either don't like the debian-like installation sceme, or who just prefer graphical installations, a lot of unix utilities have been packed in mac format at http://www.osxgnu.org .
-
su
2002-10-25 19:00:51 anonymous2 [Reply | View]
Or you can run NetInfo Manager
and do this:
Security-->Authenticate
Authenticate as an admin
Security-->Enable root user
Enter password when promted
Then in the terminal you can su to root as needed. That way you can keep your old fashioned and regular unix habits.
-sonic
-
Apple Laptop Keyboards Unsuitable for Unix Users
2002-10-25 18:13:22 anonymous2 [Reply | View]
Apple laptops are effectively unusable for unix users.
I am a long-time Unix user. That means I need to have the Ctrl key to the left of the A key. This is a genuine need, not merely a want; it is based upon ergonomics. The Ctrl key is heavily used in unix, and it must be easily accessable. It cannot be off in the lower left corner of the keyboard where it is difficult to get at, and where it distorts the position of your left hand such that you can't easily type other keys while holding the Ctrl key down.
Apple desktop keyboards are now all USB. They are all OK. The CapsLock key can be re-mapped into a Ctrl key.
Unfortunately, even in this modern age, all Apple laptops have built-in ADB keyboards. The ADB keyboard is broken-by-design. It is, in general, not possible to remap the CapsLock key into a Ctrl key.
There are some exceptions, but they are horrible kludges. They are horrible kludges because the original design of the ADB keyboard was a horrible kludge. The correct solution would be for Apple to re-design their laptop motherboards to use built-in USB keyboards. This hasn't happened yet. If you run Linux, use Debian's solution. For Mac OS X users, uControl works. There are no solutions (that I know of) for either NetBSD or OpenBSD. Please note once again that the "solutions" above are in fact kludges, because of the original bad design of the ADB keyboard.
Apple is (currently) ignoring Unix users! This is not merely speculation on my part. In an on-going email exchange I am having with an Apple employee (whom I won't name) in their marketing department, the Apple marketing person directly stated to me that Apple was catering to their historic Mac customers, and is purposely ignoring the Unix market. He also claimed that Apple would soon start paying more attention to the Unix market. I won't hold my breath. Apple has been ignoring Unix users for more than 12 years. I expect that trend to continue. (Also note that my Apple contact indicated that Macs would never ship with a 3-button mouse, even though Apple intended to port almost all X-window software and deliver it either on a CD/DVD or installed directly on each Mac's hard drive. How Unix friendly is a 1-button mouse with X programs that often require 3 buttons?)
Apple has now lost two opportunities to sell me hardware. I really wanted an Apple laptop for their superior battery life, and for the PowerPC with Altivec CPU. (The Altivec is vastly superior to the x86 line for DSP.) Because I can't live with the broken-by-design built-in ADB keyboard in all Apple laptops, Sony and IBM sold me laptops instead. If Apple fixes this problem, they will sell me a PowerBook next year; if they don't, I'll still be running OpenBSD on x86 hardware, and wishing I could use a Mac.
-
Aqua...
2002-10-25 16:49:31 anonymous2 [Reply | View]
...is the "Look and Feel" of OS X, not the graphics technology. I think you meant to say Quartz.
-
Table Corrections
2002-10-25 15:49:09 Brian Jepson |
[Reply | View]
There are some errors in the 2nd and 3rd rows of the tables. They should read:
<tr>
<td>.Trashes</td>
<td>This directory contains files that have been dragged to the Trash when the volume is not the current boot volume.</td>
</tr>
<tr>
<td>.vol/</td>
<td>This directory maps HFS+ file IDs to files.</td>
</tr>
There are other corrections and comments from various readers (thanks!), so make sure you check the comments.
- Brian
-
sudo and su pitfall (re #2)
2002-10-25 15:47:05 anonymous2 [Reply | View]
I used to use sudo all the time, but now I exclusively use "su -". Here's why I don't use sudo or su without the "-":
1) If you sudo is set so it won't ask for your
password unless you haven't used su for 10
minutes, what happens if a couple of minutes
after you intentionally run sudo to do
something, you run a script or binary that
contains (perhaps deep inside it, either
accidentally or maliciously):
sudo SOMETHING_REALLY_DANGEROUS
I belive the command will run without any
warning. I'd prefer to avoid that
possiblity.
2) I don't omit the "-" in "su - root" because
without the dash you may not get a
completely clean root envt. This can
surprise you if (for example) if you
normally set your umask at 007 (for
security or whatever) and then you run
"su root" to do something. If you expected
the root command to run with root's normal
umask of 002, it may well not -- "su root"
may run using bits of your normal user
envt -- to what extent this happens, and
under what conditions may be dependent on
your shell, shell startup scripts, os, and
version of su, and I'd rather be safe than
sorry.
One time I ended up realizing after a
complex install on a unix system, that
many files had the wrong "other" permissions
because "su root" had given root my 007
umask, not 002. Cleaning this up was a
pain.
And of course, having root inherit your user
PATH could be downright dangerous.
FWIW.
-
#9
2002-10-25 14:38:35 anonymous2 [Reply | View]
Actually for users and things the thing you want is /usr/bin/niutil
-
Log in as root
2002-10-23 19:22:56 anonymous2 [Reply | View]
I prefer to keep the (default) list of users. Instead of forcing all users to type in their user name and password, in Mac OS 10.1.5, open System Preferences, click Login, then click Show "Other User" in list of network users. To login as root click on Other User in the user list.
>You'll also want to open System Preferences, choose >Accounts, then Login Options and change Display >Login Windows as: to Name and password. Then you >can log out and log in as the root user.
-
Solution for #10
2002-10-23 12:56:16 lshastings [Reply | View]
I'm not a Unix Geek, just a newly arrived newbie from the Classic Mac side.
I found the shutdown problem you described when setting up a headless Mac OS X server. Here's what I found works for me... Instead of just Shutdown, try
Shutdown -k +0
That will log out all users except the administrator (yourself) immediately. (if you want to give users time to logout, change the +0 to +5 for five minutes, or whatever.)
BUT, this command stops here - it doesn't actually shut down the machine. So now issue the halt or reboot command. These two commands issue the needed signals to running programs to gracefully exit, and then shutdown or restart the system.
See man halt for more info.
(Here's hoping I got this one right!)
-
Type a URL with "open" in terminal opens the browser
2002-10-23 12:37:05 anonymous2 [Reply | View]
Like this:
open http://www.oreillynet.com
Sweet.
-
Item #5
2002-10-23 11:59:30 Jason Deraleau |
[Reply | View]
On #5, you don't have to use the Force Quit or restart... Think, we're Unix geeks ;)
killall -HUP Finder
-
Drag And Drop in the Terminal
2002-10-23 08:30:32 eccentricanomaly [Reply | View]
My two favorite tips:
1. You can find a file with Finder and drag and drop it into the terminal and the full path to the file will expand before your eyes! This works great with many unix utilities.
2. Typing "open filename" does the same thing as double-clicking on the file in Finder. For example, "open letter.pdf" will open the letter.pdf file in preview (or whatever other program you have set to open pdf files).
-
Additional option for #2
2002-10-23 07:58:40 anonymous2 [Reply | View]
Here's another method to gain root access in OS X's Terminal: "sudo -s"
[localhost:~] user% sudo -s
password:
[localhost:~] root#
Great article, Brian.
--
Paul Wilde L'Heureux
paul@paullheureux.com
-
(More) emacs-like keybindings
2002-10-23 00:36:14 mstillwell [Reply | View]
Great article.
One feature of OS X that I think not many Unix people know about is that it allows you to change keybindings system-wide (well, Cocoa-wide) by plonking the right file into ~/Library/KeyBindings.
I use http://beebo.org/fluff/macstuff/DefaultKeyBinding.dict to get a lot of the missing alt-key bindings as well as rebinding ctrl-a from "move to beginning of paragraph" to the more natural (to my fingers!) "move to beginning of line," etc.






