Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Make a .dmg from any directory UNIX
A recent post to the java-dev mailing list had a great script I thought I'd pass along. It allows you to make OS X disk images (.dmg) from any directory with a simple command in the terminal, like so:

mkdmg <volname> <version> <srcdir>
read more (185 words)   Post a comment  •  Comments (21)  
  • Currently 2.63 / 5
  You rated: 1 / 5 (8 votes cast)
 
[63,591 views]  View Printable Version
Option click to position terminal cursor UNIX
I don't know how I missed this before. As a new Unix user, I often don't quite type terminal instructions correctly on the first attempt. Usually, I would "up arrow" to retrieve the last command, and then backwards cursor through the command--but if the filepaths were long, I might have to go through several lines of text to correct just one or two characters of typo. The terminal being the terminal, it wouldn't respond to positioning the cursor with the mouse--or so I thought.

Well, in the terminal preferences, under the last option "Emulation", you can turn on "option click to position cursor." Which allows one to 'option click' in any command and have the cursor positioned under the mouse pointer. Particularly useful in pico, so you don't have to scroll through the whole config file.
  Post a comment  •  Comments (5)  
  • Currently 4.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[13,487 views]  View Printable Version
Ensure that cron scripts run UNIX
Having put together some incremental backup software, I was very annoyed to find that cron wasn't running the /etc/daily script because cron doesn't run while my computer is asleep, and my computer is always asleep at 3:15am when /etc/daily is set to be run.

So, I made a very simple perl script that fixes this problem. It checks the modification times for the daily, weekly, and monthly log files. If they are more than a day, week, or month old, respectively, it runs the appropriate commands.

To learn more, read on...
read more (278 words)   Post a comment  •  Comments (12)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[6,515 views]  View Printable Version
Proper Use of UNIX Layer UNIX
I've noticed that over the months that I have been reading macosxhints.com, a lot of hints advise to do UNIX level things which are not proper. They usually get the job done, but poorly. Most of these involve hint giver's confusion over when to use the various Library directories. So I decided that although many users know this information, it may be a good idea to explicitly say it.

To see the rest of this hint, read on.
read more (376 words)   Post a comment  •  Comments (19)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[5,461 views]  View Printable Version
Installing DJBDNS UNIX
If you want to serve DNS off an OS X machine, I successfully ported djbdns to OS X and wrote up a helpful HOWTO for anyone interested.

[Sudo Editor's Warning: This install is not for those faint of heart or Unix knowledge.]
  Post a comment  •  Comments (1)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[2,659 views]  View Printable Version
Converting Mac linefeeds to Unix linfeeds UNIX
I go back and forth between Darwin (and Linux at my workplace) and OS X all the time. The problem is that the convention for linefeeds is different between Unix and Mac. I know new version of MacArmyKnife can fix it, but here is the free solution.

Open the file with xemacs. As the bundled emacs does not work for this purpose, I've installed a copy through fink.

Now type:
Meta-x replace-string
^Q^M
^Q^J
This changes ^M (Mac linefeeds) to ^J (Unix linefeeds) for the entire buffer.

Save it:
^X^S
and you're done.
  Post a comment  •  Comments (19)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[5,274 views]  View Printable Version
IP Firewall UNIX
I found this great article on how to create your own firewall, with no software to install.

It is at: http://wopr.norad.org/articles/firewall.

[Sudo Editor's Note: A firewall can be a very important thing, especially if you have a full-time internet connection via DSL or cable modem. Although we have covered Firewalls on MacOSXHints.com before, I felt it worth while posting this article which explains what a firewall is, and how to use OS X's built-in tools to help protect your system. I think it is well worth reading this older article also, before you try to modify your current settings. After all, the security of your machine could be at risk.]
  Post a comment  •  Comments (8)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[4,191 views]  View Printable Version
Monitor system calls UNIX
As a transplant from other *nix operating systems, I'm used to system call monitoring tools like truss (on Solaris) and strace (on Linux).

While I haven't found anything quite like these for Darwin, sc_usage comes close. It provides a running statistical breakdown of system calls for any process ID (pid) specified on the command line. Although I haven't yet figured out how to parse its output, I expect it'll aid in figuring out where a particular app is getting hung up. In conjunction with fs_usage (mentioned in a previous hint by Ben Hines), you can also track down what files are being called. Note that this must be run in a Terminal window as root (generally via 'sudo').

Usage is:
sudo sc_usage [pid]
Apple has a developer note describing the tool, with some examples, and you can always type man sc_usage in Terminal for typically laconic Unix documentation.

(Thanks go to Fred S., Apple's Open Source Engineering Lead, who posted about these utilities in a MacPerl thread.)

[Sudo Editor's caution: f you're not comfortable with the terminal and root privileges, I would recommend holding off on this hint. ]
  Post a comment  •  Comments (7)  
  • Currently 2.25 / 5
  You rated: 1 / 5 (4 votes cast)
 
[7,431 views]  View Printable Version
Create multiple soft links with one command UNIX
I recently had to make soft links to about 50 files. The shell was not expanding the wildcard (*) symbol as expected. The syntax for doing this with the 'ln' command is:
ln -s source_file target_file
After some experimentation I found the following works perfectly.
ln -s /path/to/source/* /path/to/target/directory/
This resulted in the wildcard being expanded into each of the file names and a soft link being made to each of the files in my target directory.
  Post a comment  •  Comments (1)  
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[3,751 views]  View Printable Version
Securing Webmin using OpenSSL UNIX
Webmin is a great tool for Unices, just OK for OS X client and server. I use it to manage my Sun Solaris 8 servers at work rather than SMC. The big caveat is that using it as-is over http is unsecure. Anyone using snoop or a packet sniffer can compromise your machine(s). Using OpenSSL under MacOS X secures this wonderful and free tool.

Until recently, the headers for ssl were not available, but now they are. Apple has released the "Darwin Development Environment" which includes these headers.

For a Step-by-Step on securing Webmin via SSL, read on...
read more (278 words)   Post a comment  •  Comments (5)  
  • Currently 3.67 / 5
  You rated: 1 / 5 (3 votes cast)
 
[11,785 views]  View Printable Version