The Steel Guitar Forum Store 

Post new topic FreeBSD on MacOS
Reply to topic
Author Topic:  FreeBSD on MacOS
Jeff Hyman


From:
West Virginia, USA
Post  Posted 10 Oct 2008 3:55 pm    
Reply with quote

Anyone have a new Mac? I here they are running BSD behind the scenes. If true, has anyone gone to the shell and explored?
View user's profile Send private message Send e-mail Visit poster's website

Michael Maddex


From:
Northern New Mexico, USA
Post  Posted 11 Oct 2008 4:41 pm    
Reply with quote

Since nobody else has jumped in here, I'll try and answer your question. I came to OS X from Linux/BSD a few years ago out of curiosity and only use it once in awhile, so I'm no expert.

SYSTEM: From the beginning, Mac OS X has been built on BSD among other components. In a nutshell, at the bottom of the OS stack is Darwin, composed of BSD code and the Mach kernel from CMU. Both are free software. A pair of graphics engines rides on top of that, one Mac proprietary and one free software, OpenGL. Aqua is the GUI and sits on top of the OS stack. There are of course other components: file system, TCP/IP and so on, but that's the basic setup.

UNIX: Unfortunately, much of the functionality of the <tt>/etc/</tt> files has been transferred to a registry-like database, Netinfo. Although you'll find <tt>/etc/hosts, /etc/passwd</tt>, etc., the system doesn't read them, it reads Netinfo. As an administrator, you can edit the db with Netinfo Manager. You can get a terminal window in the GUI to explore the file system. All of the usual shell commands work. I believe that the default shell is <tt>csh</tt>. I changed mine to <tt>bash</tt> (10.2 and later) in Netinfo, not <tt>/etc/passwd</tt>.

RESOURCES: I believe that O'Reilly publishes a book called OS X for Unix Users or something similar. I haven't seen a copy. The Missing Manual: OS X by David Pogue is pretty good. I have an early edition (10.1) with a lot of typos and a few downright errors, but the newer editions seem to have fixed that. There have been editions to match each release (10.x). Building Cocoa Applications, also from O'Reilly, is a good introduction to OS X programming which uses Objective C. The projects in the book are non-trivial and the authors assume prior programming experience in C or C++.

I could go on, but this is getting kind of long. I'm really a Slackware kind of guy, OS X is just a sideline for me, but I'll be glad to try and answer any questions you have.

HTH.
_________________
"For every expert, there is an equal and opposite expert." -- Arthur C. Clarke
View user's profile Send private message Send e-mail Visit poster's website

b0b


From:
Cloverdale, CA, USA
Post  Posted 11 Oct 2008 9:23 pm    
Reply with quote

Michael obviously knows the nuts and bolts better than me. I'm not a Unix power user, but I'm not scared of it either.

There are a few oddities when you open the shell. You can't login as root. If you want to do something with root access, you have to preface it with <code>sudo</code>.

Filenames aren't case sensitive. That really threw me when I encountered it.

It doesn't use the FreeBSD distribution/update system (I forget what that was called. RPM, maybe?). Thank goodness! That thing is really awkward. Apple has its own Software Update program that's very user-friendly.
_________________
-𝕓𝕆𝕓- (admin) - Robert P. Lee - Recordings - Breathe - D6th - Video
View user's profile Send private message Visit poster's website

Jeff Hyman


From:
West Virginia, USA
Post  Posted 12 Oct 2008 12:07 am    
Reply with quote

Michael,
I've gotten very use to bash, and prefer it over csh...but my real comfort level is in the korn shell (ksh). /etc/passwd... so it exists and is not used? is that correct? Does the Netinfo deal with /etc/passwd at any level behind the scenes? I guess I'm trying to figure out why Mac would even put /etc/passwd on the system at all. Is there a /tcb directory? BTW: You have more knowledge then you take credit for :-)

Bob,

Case insensitive! Wow. What about blank spaces in a file or dir name? That's to much like windoze for me <g>. Sounds like grep doesn't need the -i or -y flag.

With all the good feedback, let me ask:

# file <compiled_filename>
What does it return?

# tar -?
How does 'tar' function?

The su command is actually a good thing. Using su to get a root login is common on many Unix OS's. My first experience with this was the DEC Alpha. It didn't make sense back in those days... but with all the security issues it's actually one more level a hacker needs to get past.


Anyway... I want to leap into the backup and crash recovery side of the MacOS. If 'tar' or even 'cpio' work from the shell will certainly be good news for me.
View user's profile Send private message Send e-mail Visit poster's website

Randy Phelps


From:
California, USA
Post  Posted 12 Oct 2008 7:53 pm    
Reply with quote

Netinfo has been discontinued if you have later versions of the OS. OpenDirectory is now what is used and with a little time I think you'll find that if you are a unix guy you'll find it is a sterling unix.

it is trivial to cease using the gui if that is your choice, I'd also recommend installing and enabling x11.

There are several good unix boards on the apple support site... and some good links at slashdot...

I've been a user of what became OSX since late 98.. I dig it and it keeps getting better... but I am biased!
View user's profile Send private message Send e-mail

Jeff Hyman


From:
West Virginia, USA
Post  Posted 13 Oct 2008 12:37 am    
Reply with quote

Randy,

Thanks for the reply. Do you keep any valuable files on your Mac? Whats your backup method and utility?
I'm digging to see how data is stored and recovered. 4mm? USB? SCSI? ftp? ssh? Samba? NAS?

To this day, I stay at the command prompt. GUI has never been my choice. Correct me if I'm wrong, but if I jump into the Mac world, I better get use to GUI? ... or at the SysAdmin level it's acceptable to do chores at the command prompt? How would a simple character based interface be received. Easy to use, would include source.

I forgot that the Unix community has a large wealth of musicians. Seems programmers and music fit well. I can remember back in the 80's at the SCO Forums in Santa Cruz. Lots of entertainment from attendees and exibitors.
View user's profile Send private message Send e-mail Visit poster's website

Brad Bechtel


From:
San Francisco, CA
Post  Posted 13 Oct 2008 8:22 am    
Reply with quote

There are a number of good resources out there for OS X and Unix, both within Apple's own web site and in various independent sites.
http://www.apple.com/support/leopard/
http://developer.apple.com/
http://www.osxfaq.com/tutorials/LearningCenter/
http://www.oreillynet.com/pub/a/mac/2002/10/22/macforunix.html
http://forums.macosxhints.com/index.php

You can always include a Terminal window as a startup item if that's what you prefer.

If you're really into the meat of this issue, sign up for a free Apple Developer account.
http://tinyurl.com/qnq2y

Disclaimer: I work there.
_________________
Brad’s Page of Steel
A web site devoted to acoustic & electric lap steel guitars
View user's profile Send private message Send e-mail Visit poster's website

Jeff Hyman


From:
West Virginia, USA
Post  Posted 13 Oct 2008 11:03 am    
Reply with quote

Brad,
Thanks for the links. The developers program is exactly where I'm heading. Do you personally get into any low-level code there?
View user's profile Send private message Send e-mail Visit poster's website

John Cipriano


From:
San Francisco
Post  Posted 17 Oct 2008 8:03 pm    
Reply with quote

Jeff, tar and file work from the terminal. Tar is the GNU version, I don't know about file. cpio is there as well. Most of the day to day *nix stuff is there.

I think they have actually gone back to using /etc/hosts in Leopard. At least, that's where I add my hosts, and they work.

You can get a lot of what's missing from a traditional Unix (like X server) via MacPorts or something similar.
View user's profile Send private message Send e-mail

Jeff Hyman


From:
West Virginia, USA
Post  Posted 20 Oct 2008 3:36 pm    
Reply with quote

John,

Thanks for the reply and info. I'm still gathering details. If you get a chance, what is the output of:

# file <compiled_filename>
What does it return?

# tar -?
How does 'tar' function?
View user's profile Send private message Send e-mail Visit poster's website

b0b


From:
Cloverdale, CA, USA
Post  Posted 20 Oct 2008 4:02 pm    
Reply with quote

Code:

bob-lees-mac-pro:~ b0bMini$ file <compiled_filename>
-bash: syntax error near unexpected token `newline'
bob-lees-mac-pro:~ b0bMini$ tar -?
Usage: tar [OPTION...] [FILE]...
GNU `tar' saves many files together into a single tape or disk archive, and can
restore individual files from the archive.

Examples:
  tar -cf archive.tar foo bar  # Create archive.tar from files foo and bar.
  tar -tvf archive.tar         # List all files in archive.tar verbosely.
  tar -xf archive.tar          # Extract all files from archive.tar.

 Main operation mode:

  -A, --catenate, --concatenate   append tar files to an archive
  -c, --create               create a new archive
  -d, --diff, --compare      find differences between archive and file system
      --delete               delete from the archive (not on mag tapes!)
  -r, --append               append files to the end of an archive
  -t, --list                 list the contents of an archive
  -u, --update               only append files newer than copy in archive
  -x, --extract, --get       extract files from an archive

 Operation modifiers:

  -g, --listed-incremental=FILE   handle new GNU-format incremental backup
  -G, --incremental          handle old GNU-format incremental backup
      --ignore-failed-read   do not exit with nonzero on unreadable files
  -k, --keep-old-files       don't replace existing files when extracting
      --keep-newer-files     don't replace existing files that are newer than
                             their archive copies
      --no-overwrite-dir     preserve metadata of existing directories
  -n, --seek                 Archive is seekable
      --occurrence[=NUMBER]  process only the NUMth occurrence of each file in
                             the archive. This option is valid only in
                             conjunction with one of the subcommands --delete,
                             --diff, --extract or --list and when a list of
                             files is given either on the command line or via
                             -T option. NUMBER defaults to 1.
      --overwrite            overwrite existing files when extracting
  -O, --to-stdout            extract files to standard output
      --recursive-unlink     empty hierarchies prior to extracting directory
      --remove-files         remove files after adding them to the archive
  -S, --sparse               handle sparse files efficiently
  -U, --unlink-first         remove each file prior to extracting over it
  -W, --verify               attempt to verify the archive after writing it

 Handling of file attributes:

      --atime-preserve       don't change access times on dumped files
      --group=NAME           force NAME as group for added files
      --mode=CHANGES         force (symbolic) mode CHANGES for added files
  -m, --touch                don't extract file modified time
      --no-same-owner        extract files as yourself
      --no-same-permissions  do not extract permissions information
      --numeric-owner        always use numbers for user/group names
      --owner=NAME           force NAME as owner for added files
  -p, --preserve-permissions, --same-permissions
                             extract permissions information
      --preserve             same as both -p and -s
      --same-owner           try extracting files with the same ownership
  -s, --preserve-order, --same-order
                             sort names to extract to match archive

 Device selection and switching:

  -f, --file=ARCHIVE         use archive file or device ARCHIVE
      --force-local          archive file is local even if has a colon
  -F, --info-script=NAME, --new-volume-script=NAME
                             run script at end of each tape (implies -M)
  -L, --tape-length=NUMBER   change tape after writing NUMBER x 1024 bytes
  -M, --multi-volume         create/list/extract multi-volume archive
      --rmt-command=COMMAND  use given rmt COMMAND instead of rmt
      --rsh-command=COMMAND  use remote COMMAND instead of rsh
      --volno-file=FILE      use/update the volume number in FILE

 Device blocking:

  -b, --blocking-factor=BLOCKS   BLOCKS x 512 bytes per record
  -B, --read-full-records    reblock as we read (for 4.2BSD pipes)
  -i, --ignore-zeros         ignore zeroed blocks in archive (means EOF)
      --record-size=NUMBER   SIZE bytes per record, multiple of 512

 Archive format selection:

  -H, --format=FORMAT        create archive of the given format.

 FORMAT is one of the following:

    gnu                      GNU tar 1.13.x format
    oldgnu                   GNU format as per tar <= 1.12
    pax                      POSIX 1003.1-2001 (pax) format
    posix                    Same as pax
    ustar                    POSIX 1003.1-1988 (ustar) format
    v7                       old V7 tar format

  -j, --bzip2                filter the archive through bzip2
      --old-archive, --portability
                             same as --format=v7
      --pax-option=keyword[[:]=value][,keyword[[:]=value], ...]
                             control pax keywords
      --posix                same as --format=posix
      --use-compress-program=PROG
                             filter through PROG (must accept -d)
  -V, --label=TEXT           create archive with volume name NAME. At
                             list/extract time, use TEXT as a globbing pattern
  -z, --gzip, --gunzip, --ungzip   filter the archive through gzip
  -Z, --compress, --uncompress   filter the archive through compress

 Local file selection:

      --after-date=DATE      same as -N
      --anchored             exclude patterns match file name start
      --backup[=CONTROL]     backup before removal, choose version CONTROL
  -C, --directory=DIR        change to directory DIR
      --exclude=PATTERN      exclude files, given as a PATTERN
      --exclude-caches       exclude directories containing a cache tag
  -h, --dereference          dump instead the files symlinks point to
      --ignore-case          exclusion ignores case
  -K, --starting-file=MEMBER-NAME
                             begin at member MEMBER-NAME in the archive
      --newer-mtime=DATE     compare date and time when data changed only
      --no-anchored          exclude patterns match after any / (default)
      --no-ignore-case       exclusion is case sensitive (default)
      --no-recursion         avoid descending automatically in directories
      --no-wildcards         exclude patterns are plain strings
      --no-wildcards-match-slash   exclude pattern wildcards do not match '/'
      --null                 -T reads null-terminated names, disable -C
  -N, --newer=DATE-OR-FILE   only store files newer than DATE-OR-FILE
      --one-file-system      stay in local file system when creating archive
  -P, --absolute-names       don't strip leading `/'s from file names
      --recursion            recurse into directories (default)
      --strip-components=NUMBER   strip NUMBER leading components from file
                             names
      --suffix=STRING        backup before removal, override usual suffix ('~'
                             unless overridden by environment variable
                             SIMPLE_BACKUP_SUFFIX
  -T, --files-from=FILE-OF-NAMES   get names to extract or create from file
                             NAME
      --wildcards            exclude patterns use wildcards (default)
      --wildcards-match-slash   exclude pattern wildcards match '/' (default)
  -X, --exclude-from=FILE    exclude patterns listed in FILE

 Informative output:

      --checkpoint           display progress messages every 10th record
  -v, --verbose              verbosely list files processed

      --check-links          print a message if not all links are dumped
      --index-file=FILE      send verbose output to FILE
  -R, --block-number         show block number within archive with each
                             message
      --show-defaults        Show tar defaults
      --show-omitted-dirs    When listing or extracting, list each directory
                             that does not match search criteria
      --totals               print total bytes written while creating archive
      --utc                  print file modification dates in UTC
  -w, --interactive, --confirmation
                             ask for confirmation for every action

 Compatibility options:

  -o                         when creating, same as --old-archive. When
                             extracting, same as --no-same-owner

 Other options:

  -?, --help                 Give this help list
      --license              Print license and exit
      --usage                Give a short usage message
      --version              Print program version

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.
The version control may be set with --backup or VERSION_CONTROL, values are:

  t, numbered     make numbered backups
  nil, existing   numbered if numbered backups exist, simple otherwise
  never, simple   always make simple backups

*This* tar defaults to:
--format=gnu -f- -b20 --rmt-command=/sw/lib/rmt --rsh-command=/usr/bin/rsh

Report bugs to <bug>.
bob-lees-mac-pro:~ b0bMini$


_________________
-𝕓𝕆𝕓- (admin) - Robert P. Lee - Recordings - Breathe - D6th - Video
View user's profile Send private message Visit poster's website

Jeff Hyman


From:
West Virginia, USA
Post  Posted 20 Oct 2008 11:07 pm    
Reply with quote

Bob... that's what I was lookin' for!

TIA!
View user's profile Send private message Send e-mail Visit poster's website

John Cipriano


From:
San Francisco
Post  Posted 25 Oct 2008 2:26 pm    
Reply with quote

Here's the output of file on the firefox binary.

Code:
mrjones:MacOS john$ file firefox-bin
firefox-bin: Mach-O universal binary with 2 architectures
firefox-bin (for architecture ppc):   Mach-O executable ppc
firefox-bin (for architecture i386):   Mach-O executable i386


Most Mac apps nowadays are compiled for both PPC and Intel and shipped that way. I have an Intel Mac.

OS X apps are Mach-O format, not ELF. There is no ldd or objdump. There is a program called otool for looking at headers, dependencies, hints table, etc. This link might be of interest to you:

http://0xfe.blogspot.com/2006/03/how-os-x-executes-applications.html

Disclaimer: I'm not a C coder. I don't know what a hints table is, just that they exist and people look at them sometimes Very Happy I do my stuff in scripting languages.
View user's profile Send private message Send e-mail

Jeff Hyman


From:
West Virginia, USA
Post  Posted 25 Oct 2008 3:46 pm    
Reply with quote

Thanks John. BTW: Don't knock scripting. My real comfort zone is bash scripting.
View user's profile Send private message Send e-mail Visit poster's website


All times are GMT - 8 Hours
Jump to:  

Our Online Catalog
Strings, CDs, instruction,
steel guitars & accessories

www.SteelGuitarShopper.com

Please review our Forum Rules and Policies

Steel Guitar Forum LLC
PO Box 237
Mount Horeb, WI 53572 USA


Click Here to Send a Donation

Email admin@steelguitarforum.com for technical support.


BIAB Styles
Ray Price Shuffles for
Band-in-a-Box

by Jim Baron
HTTP