Showing posts with label Mac OS X. Show all posts
Showing posts with label Mac OS X. Show all posts

Tuesday, November 4, 2014

bash shell tab auto-completion and history command completion

If you have this in your /etc/inputrc or ~/.inputrc, you will no longer have to hit the <tab> key twice to produce a list of all possible completions. A single <tab> will suffice. This setting is highly recommended.

# vi ~/.bash_profile
#!/bin/bash
source ~/.bashrc # get aliases

# vi ~/.bashrc
### alias
alias ls='ls --color=auto'
alias ll='ls -l'
alias h='history'

### ls with color
export CLICOLOR=1 # Use colors (if possible)
export LSCOLORS="ExGxFxdxCxDxDxBxBxExEx"

### display history command with date and time
export HISTTIMEFORMAT="%m/%d/%y %T "

### Prompt
PS1='\e[0;32m\u@\h \w #\e[m '

#######
# Note: on Ubuntu, xterm-256color may be in different place, try this:
# find /lib/terminfo /usr/share/terminfo -name "*256*"
# Note: tmux respects screen-256color
#######
#if [ -e /usr/share/terminfo/x/xterm-256color ]; then
# export TERM='xterm-256color'
#else
# export TERM='xterm-color'
#fi

### Make bash check its window size after a process completes
#shopt -s checkwinsize

Bash tab auto-completion and history completion by using ~/.inputrc:
# vi ~/.inputrc
### enable filename tab auto-completion
set show-all-if-ambiguous on
set show-all-if-unmodified on

### if you don't want case-sensitivity
#set completion-ignore-case on

### bash history completion to complete what's already on the line
### arrow up
"\e[A": history-search-backward
### arrow down
"\e[B": history-search-forward

Note: A bit background explanation:
Bash is using readline to handle the prompt. ~/.inputrc is the configuration file for readline.
Read the bash manual for more information about readline. There you can also find more history related readline commands.

To get the escape codes for the arrow keys you can do the following:
  1. Start cat in a terminal (just cat, no further arguments).
  2. Type keys on keyboard, you will get things like ^[[A for up arrow and ^[[B for down arrow.
  3. Replace ^[ with \e.
Note: Normally, Up and Down are bound to the Readline functions previous-history and next-history respectively. I prefer to bind PgUp/PgDn to these functions, instead of displacing the normal operation of Up/Down.

# vi ~/.inputrc
"\e[5~": history-search-backward
"\e[6~": history-search-forward

Note: use "bind -p" or "bind -P" to get a list of bash key bindings.

Note: .inputrc will get read whenever you start a new bash process.

Note: After you modify ~/.inputrc, restart your shell or use Ctrl+X, Ctrl+R to tell it to re-read ~/.inputrc.

Note: please notice that ~/.inputrc and /etc/inputrc are NOT bash scripts, so please don’t try to source them. So, restart your Terminal.

Bash tab auto-completion and history completion by using ~/.bashrc:
# vi ~/.bashrc
### bash history completion to complete what's already on the line
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'

From the bash manpage:
When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.

When a login shell exits, bash reads and executes commands from the file ~/.bash_logout, if it exists.

When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if that file exists. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of ~/.bashrc.

Thus, if you want to get the same behavior for both login shells and interactive non-login shells, you should put all of your commands in either .bashrc or .bash_profile, and then have the other file source the first one.

===================================================
When working with Linux, Unix, and Mac OS X, I always forget which bash config file to edit when I want to set my PATH and other environmental variables for my shell. Should you edit .bash_profile or .bashrc in your home directory?
You can put configurations in either file, and you can create either if it doesn’t exist. But why two different files? What is the difference?
According to the bash man page, .bash_profile is executed for login shells, while .bashrc is executed for interactive non-login shells.

What is a login or non-login shell?

When you login (type username and password) via console, either sitting at the machine, or remotely via ssh: .bash_profile is executed to configure your shell before the initial command prompt.

But, if you’ve already logged into your machine and open a new terminal window (xterm) inside Gnome or KDE, then .bashrc is executed before the window command prompt. .bashrc is also run when you start a new bash instance by typing /bin/bash in a terminal.

Why two different files?

Say, you’d like to print some lengthy diagnostic information about your machine each time you login (load average, memory usage, current users, etc). You only want to see it on login, so you only want to place this in your .bash_profile. If you put it in your .bashrc, you’d see it every time you open a new terminal window.

Mac OS X — an exception

An exception to the terminal window guidelines is Mac OS X’s Terminal.app, which runs a login shell by default for each new terminal window, calling .bash_profile instead of .bashrc. Other GUI terminal emulators may do the same, but most tend not to.

Recommendation

Most of the time you don’t want to maintain two separate config files for login and non-login shells — when you set a PATH, you want it to apply to both. You can fix this by sourcing .bashrc from your .bash_profile file, then putting PATH and common settings in .bashrc.

To do this, add the following lines to .bash_profile:
if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi
Now when you login to your machine from a console .bashrc will be called.

Reference:
http://www.caliban.org/bash/index.shtml

http://stackoverflow.com/questions/902946/about-bash-profile-bashrc-and-where-should-alias-be-written-in

http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html

http://askubuntu.com/questions/59846/bash-history-search-partial-up-arrow

Tuesday, February 28, 2012

OpenVPN client - Viscosity on Mac OS X and Windows

OpenVPN client - Viscosity on Mac OS X and Windows
http://www.thesparklabs.com/viscosity/

Monday, October 31, 2011

Softwares I have installed on Mac

// on 2011-02-20.
VLC Player (highly recommended) - play lots of different video formats, including avi, mpeg, rm, rmvb, wmv, dvd, vob, and more!

// on 2011-02-20.
Adium - a free instant messaging application for Mac OS X that can connect to AIM, MSN, Jabber, Yahoo, and more.

// on 2011-02-20.
Google Chrome - Google Chrome is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier.

// on 2011-03-26
witch - Command-Tab is great…if you only ever have one window open in each of your applications. With more than one window, though, it's a hassle to find the one you want. Witch solves that problem by taking you directly to the window you want to reach.

// on 2011-03-26
Navicat - Navicat for MySQL is a powerful Database administration and development tool for MySQL. It works with any MySQL Database Server from version 3.21 or above, and supports most of the latest MySQL features including Trigger, Stored Procedure, Function, Event, View, and Manage User, etc.

//
teamviewer - is our solution for easy and friendly desktop sharing. You can remote control a partner’s desktop to give online assistance, or you can show your screen to a customer - all without worrying about firewalls, IP addresses and NAT.

//
Chicken of the VNC - is a VNC client for Mac OS X. A VNC client allows one to display and interact with a remote computer screen.

//
JollysFastVNC - is a secure ARD and VNC client. Its aim is to be the best and most secure VNC client on the Mac. TaoofMac actually thinks it already has reached this goal.

Saturday, October 1, 2011

Apache, PHP, MySQL, APC

# vi /etc/apache2/httpd.conf

In /etc/apache2/httpd.conf, uncomment this line:

LoadModule php5_module libexec/apache2/libphp5.so

# sudo apachectl restart

Create /etc/php.ini and make it writable

# cd /etc
# sudo cp php.ini.default php.ini
# sudo chmod 444 php.ini

Uncomment it and insert your time zone (http://php.net/manual/en/timezones.php)

date.timezone = America/Vancouver
Restart Apache

sudo apachectl restart

MySQL

Download the MySQL package for Mac OS X.5 (32 or 64 bits depending on your machine)
Install everything in the package in this order: mysql, the startup item, the preference pane.
Start MySQL in the preference pane.

Test it's working:

# /usr/local/mysql/bin/mysql

Fix mysql.sock location in php.ini

In /etc/php.ini, replace the three occurences of /var/mysql/mysql.sock by /tmp/mysql.sock:

pdo_mysql.default_socket=/tmp/mysql.sock
mysql.default_socket = /tmp/mysql.sock
mysqli.default_socket = /tmp/mysql.sock

Restart Apache
# sudo apachectl restart

# cp /usr/local/mysql/support-files/my-huge.cnf /etc/my.cnf
===
Extra

Activate PHP short tags

In /etc/php.ini, under Language Options, change

short_open_tag = Off
to

short_open_tag = On

Restart Apache
# sudo apachectl restart
===
APC (Alternative PHP Cache)

instal pcre first
// Download the new software.
curl -O http://downloads.sourceforge.net/project/pcre/pcre/8.12/pcre-8.12.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.12%2F&ts=1314943607&use_mirror=voxel

// Uncompress it.
# tar zxvf pcre-8.01.tar.gz

// Go into the new directory.
# cd pcre-8.01

// Prepares for compiling?
# ./configure --prefix=/usr/local

# make

# make install

alternative method to use pcre, We can install that with Homebrew:
# brew install pcre

Now we start installing APC:
# pecl install apc

# vi /etc/php.ini
extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/apc.so
extension=apc.so
apc.enabled=1
apc.shm_segments=1
apc.shm_size=32M
apc.cache_by_default=1
apc.stat=1
;; For Drupal upload progress.
;apc.rfc1867=1
;; 2 hours
;apc.stat=7200

So to summarize, here’s what I did:
# sudo pear update-channels
# brew install pcre
# sudo pecl install apc-3.1.6

Reference:
http://maestric.com/doc/mac/apache_php_mysql_snow_leopard
http://i.justrealized.com/2010/install-php-apc-mac-os/
http://www.gigoblog.com/2011/01/23/install_memcache_and_apc_on_mac_os_x_server/

Friday, September 23, 2011

Homebrew: 新一代 OSX 套件管理工具

身為一個 programmer,總是需要在 Mac 上裝一些開放源碼程式,除了自己下載、編譯( ./configure && make && make install) 之外,通常最方便的選項就是用套件管理工具來處理安裝、升級跟移除。

Homebrew 之前,最常見的就是 MacPortsFink 了,我自己本來是用 MacPorts,它有個討厭的特點就是它不依賴系統內已經安裝好的套件,完全自成一局 (當然,這也算是一種 isolation 優點,如果你不爽的時候只要砍掉 /opt 就移掉了)。所以常常為了裝個小套件,就還要安裝一堆它依賴的套件(例如:重複裝一套你系統裡已經有的 Perl,crazy!),十分耗費時間跟空間,而且到最後我也搞不清楚它裝了一大堆我不知道拿來幹什麼用的套件。

Homebrew 則盡量依賴系統內已經有的套件、它的套件 formula 是用簡單的 Ruby 寫的,所以你可以 fork Homebrew repository 自行修改維護、它自己用 Git 管理自己,升級十分方便。

安裝及使用方式

1. 要先安裝有 Xcode,你才能編譯東西。
2. 下載執行 http://gist.github.com/323731

安裝好之後,就有以下指令可以使用

brew search 搜尋套件
brew info 查詢套件資訊
brew list 已經裝了哪些套件
brew update 更新 homebrew 自己
brew install 安裝套件

例如,我馬上就安裝了 wget 跟 git 這兩個是我最基本要用的工具,一下就搞定了,cool!

brew install wget
brew install git

參考資料

homebrew — Mac OS X 下新的软件包管理工具
Homebrew: OS X’s Missing Package Manager
http://ihower.tw/blog/archives/4308/comment-page-1#comment-60142

Thursday, August 25, 2011

download files from web via the OS x command line


curl -O http://example.com/test.pdf

You might want to include a few extra bits in that post. First, always include the -L (or –location) switch, since that will allow curl to follow any redirects (if the file gets moved, but there is a redirect for it). Also, if the URL’s file part (the section after the last slash) is not pretty, you can give a name for the downloaded file by using a lower-case -o (instead of -O), followed by a space and the name in quotes. Also, always put the URL in single-quotes – ampersands and a few other characters will break on the command line if they aren’t in quotes. Here’s an example of those ideas combined:

curl -L -o ‘myfile.dmg’ ‘http://www.somewebsite.com/files/getdmg?id=24‘

Reference:
http://osxdaily.com/2007/05/11/download-files-from-the-web-via-the-os-x-command-line/

Sunday, July 24, 2011

How to determine filesystem type on Mac OS X

# mount

/dev/disk0s2 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
/dev/disk1s2 on /Volumes/Backup_Mobile (hfs, local, nodev, nosuid, journaled)

how to export photos images pictures from iPhone to Mac

Method 1 - use Image Capture:

on Mac > Applications > Image Capture.

Method 2 - use iPhoto:

on Mac > Applications > iPhoto > select photos > click "import selected".

Files will be stored in the iPhoto library. Now, you can copy and paste files from iPhoto library to your hard drive.

Mount ISO image on Mac

Method 1:
# hdiutil mount sample.iso

Method 2:
You can mount ISO images in Mac OS X by using Disk Utility, located in the /Applications/Utilities/ directory. After you have launched Disk Utility, navigate from the Disk Utility menu down to “Open Image File” and select your ISO file. The ISO should now appear mounted on the Mac OS desktop. Yes, this works for other disk image files too (dmg, img, etc).

Reference:
http://osxdaily.com/2008/04/22/easily-mount-an-iso-in-mac-os-x/

Sunday, July 10, 2011

mount NTFS FAT32 on mac OS X

Rename the original /sbin/mount_ntfs tool:

sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.orig

Create a script like this:

#!/bin/sh
/sbin/mount_ntfs.orig -o rw "$@“

save the script to /sbin/mount_ntfs

sudo chown root:wheel /sbin/mount_ntfs
sudo chmod 755 /sbin/mount_ntfs

Enjoy R/W access to NTFS volumes...

In case you don't like it

sudo mv /sbin/mount_ntfs.orig /sbin/mount_ntfs

and everything is back to R/O.

Make sure to check that mount_ntfs is listed as -rwxr-xr-x and root wheel when you type ls -al /sbin/mount_ntfs and you're good to go.

P.S.
If it isn't working for you, it may be that the NTFS partition wasn't cleanly unmounted previously (e.g. not using safe eject in Windows). To check if this is the case, open Console in Utilities, and go to 'All Messages' instead of 'Console Messages'. Search for 'ntfs' and you may come across an error that displays like this:
NTFS-fs error (device /dev/disk3s1, pid 435): ntfs_system_inodes_get(): $LogFile is not clean. Mounting read-only. Mount in Windows.
You need to plug the disk into Windows-running system, and do a safe eject. Then the NTFS partition will mount in read/write mode.

Good luck!
Again thanks iBlacky

Reference:
http://forums.macrumors.com/showthread.php?t=785376&page=2

Saturday, May 28, 2011

Sunday, April 17, 2011

running wireshark as root on Mac OSX

running wireshark as root on Mac OSX
In Python on February 22, 2010 by Tzury Bar Yochay Tagged: mac, wireshark

After installing the .dmg packge you should run

$ sudo /Applications/Wireshark.app/Contents/MacOS/Wireshark
In order to capture traffic on the interfaces

Reference:
http://evalinux.wordpress.com/2010/02/22/running-wireshark-as-root-on-mac-osx/

Sunday, March 20, 2011

copy selection to OS X system clipboard in Vim

Method 1:
To copy the output in Mac OSX Terminal to clipboard, you can use the the command pbcopy:

Add this to your ~/.vimrc:

" ctrl-x for cut
vmap <C-x> :!pbcopy<cr>
" ctrl-c for copy
vmap <C-c> :w !pbcopy<cr><cr>

Then, on your desktop application, press command-v to paste.

Note: pbcopy is a system command. For example:
# cat fileName.txt | pbcopy

Method 2:
Download and install MacVim

For MacVim and Windows Gvim, simply add the following to your ~/.vimrc:

set clipboard=unnamed

Now all operations such as yy, D, and P work with the clipboard. No need to prefix them with "* or "+.

Method 3:
If the clipboard is enabled, you can copy a selected region to the clipboard by hitting:

"*y
or
"+y

Note: In X11, Vim's "* is PRIMARY, "+ is CLIPBOARD, and SECONDARY doesn't get a named register. (Not that anybody uses it...).

To see if it is enabled, execute vim --version and look for +clipboard or -clipboard. For example, it's not enabled by default on my 10.6.0 box:

# vim --version | grep clipboard
-clipboard

For MacVim and Windows Gvim, simply add the following to your ~/.vimrc:

set clipboard=unnamed

Now all operations such as yy, D, and P work with the clipboard. No need to prefix them with "* or "+.

Method 4:
If you are using MacPorts you can upgrade your VIM to include clipboard support via:

port install vim +x +x11

Now you use the "+ register to yank your text directly to your Mac clipboard. Works like a charm.

Reference:
http://stackoverflow.com/questions/677986/vim-copy-selection-to-os-x-clipboard

Sunday, February 20, 2011

Why FreeBSD?

Choosing an Operating System


Mac OS X has some clear advantages as a personal workstation,
especially for non computer gurus. It runs MRI tools side-by-side with
commercial publication software such as Adobe, Corel Draw, and MS
Office. The Mac is also by far the easiest system for "normal" people
to manage.

FreeBSD (as well as its
derivatives)
also has some clear advantages over OS X, which may not
be apparent to the average user, so I will discuss some of them below.


One problem the Mac in a networked computer lab, is that some fMRI
applications (e.g. Caret, fslview) are Aqua applications on the Mac,
and hence can't be used effectively from a remote display. Aqua is
Apple's proprietary GUI, which is used for most Mac applications, and
works only on the console.


On FreeBSD, Linux, and other "pure" Unix systems, virtually all
graphical applications use the X11 networked graphics API, which means
they run the same on a remote display as they would on the console
(perhaps somewhat slower due to network bottlenecks, although this
usually isn't a problem.)


In case you were wondering, no, Apple Remote Desktop (ARD) and VNC
won't help with running Aqua applications remotely. There are two reasons:


  1. They take over the console desktop, rather than allow additional
    login sessions on a separate display, as X11 does.
  2. The graphics are terribly slow. ARD and VNC are designed primarily
    as administration tools, and as a way to access your desktop remotely
    on occasion, whereas X11 was designed to handle intensive day-to-day
    graphics work over a (reasonably fast) network.

FreeBSD as a Server and Desktop

FreeBSD, in my experience, has no peer as a server operating system, and makes a pretty good desktop system for most purposes.
The one weak spot I've run into is dealing with multimedia on the WEB. Browser plugins such as RealPlayer and Flash Player need frequent updates, and FreeBSD does not yet have a system in place for installing and updating them easily. For closed-source commercial plugins, FreeBSD must rely on the Linux binaries, and there is sometimes an additional lag between their release for Linux, and their usability on FreeBSD. All in all, though, FreeBSD runs pretty much the same software as Linux. Virtually any open source program that runs on Linux is also available for FreeBSD, and FreeBSD will run most closed source Linux programs as well.

Multitasking

FreeBSD's multitasking is far smoother than in any other OS I've used (and I've used a lot of them). It takes a remarkably heavy load to cause any noticeable degradation in response times. I routinely run computationally intensive programs in the background without suffering any discomfort with my desktop applications such as OpenOffice.org, Firefox, Thunderbird, etc. In most other operating systems, including OS X, desktop applications become choppy and sluggish when other CPU and memory intensive jobs are running. Running background jobs under 'nice' (to lower their CPU priority) can make a huge difference on most other platforms, but it's impossible to get every other user to use it consistently. On FreeBSD, the CPU scheduling is so good that the impact of 'nice' isn't very noticeable, but it's still a good habit to use it.

High Performance Filesystem

FreeBSD uses UFS2, a non-journalling, very fast, very reliable filesystem. Journalling filesystems, in my opinion, are overrated and more of a security blanket than a real benefit. This is not to say that journalling filesystems are "bad"; only that there are other ways to accomplish the same benefits of a journal. I'm thankful that FreeBSD has avoided following the crowd of operating systems adopting journalling filesystems. This demonstrates a commitment to facts and reason above marketing concerns.
For readers unfamiliar with this subject, the journal is a dedicated area of disk used to "buffer" write operations, instead of using RAM for this purpose. This means that write operations are immediately stored on disk, and in the event of a system crash, the journal can be replayed to quickly restore the integrity of the filesystem. Although journals are very effective in restoring filesystem integrity, many people don't realize that they aren't the only solution. The disadvantage of journalling, of course, is that disk is much slower than RAM, and writing data (or meta-data) to the journal and then again to the final location in the filesystem increases the disk head movements necessary to complete a write operation to a file.
UFS2 uses an alternative strategy, known as soft-updates. Soft-updates solve the problems that would make it difficult to repair a filesystem, without sacrificing the performance benefits of memory buffers. There are many articles about the details of soft-updates available on the WEB, so I won't get into details here. For a brief explanation, see the Wikipedia article.
Linux users who have worked with EXT2 often assume that FreeBSD's UFS2 will suffer the same painfully slow filesystem checks, because it doesn't use a journal. However, in the many years since soft-updates were introduced to FreeBSD, I've never seen a filesystem check take more than a few minutes, even on my largest RAID arrays, and I've never suffered a significant loss of data, even in the case of a sudden power outage.
Another common misconception is that journals greatly reduce data loss in the event of a crash. In reality, however, memory-buffers are synchronized to disk about every 30 seconds on a typical Unix system, so at most a fully journalled filesystem will save an additional 30 seconds worth of work. The real benefit and goal of journals is to alleviate the painfully slow (often over an hour long) filesystem checks/repairs that were common to older memory-buffered filesystems, such as EXT2. On that note, I would never advise Linux users to go back to EXT2. Of the filesystems available on Linux, those using journals are clearly the best. My personal recommendation is reiserfs, which in my experience, outperforms EXT3 by a wide margin. Of course, results may vary for a particular application, so if filesystem performance is a major concern, you should do your own benchmarking before you decide.

Ports and Packages

Another important feature of FreeBSD is the ports system, which makes it trivial to download and install (without searching the Internet) virtually all of the popular open source software, and some closed-source programs as well. With the ports/packages system, there is no need to search the WEB for software, and then figure out how to compile it on your system. Currently over 16,000 popular software programs can be found in the ports system, easily searched or browsed on the FreeBSD WEB site, and downloaded and installed with a single command. I've ported many MRI tools to FreeBSD to make them easier for myself and others to install. These ports can be found here.

Stability

I would argue that stability is the most important measure of a system with regard to minimizing computing costs. Talented systems administrators are very hard to come by, and consequently, their time is very expensive. Every system malfunction means time and money down the drain. The more stable your systems are, the more systems can be managed in a given number of admin-hours.
Obviously, system stability also affects the productivity of the users. The major goal in designing a computing system should always be to minimize work interruptions. This means minimizing system outages and malfunctions, and well as minimizing the impact of a system outage. Running FreeBSD will take care of the former. The latter is best served by distributing load as much as possible, rather the centralizing it. E.g., distribute server responsibilities among several systems, so that if one goes down, users will still be able to access the functionality of those that remain.
FreeBSD is by far the most stable operating system I've ever worked with. (And I've worked with a lot of them.) Most of my FreeBSD systems run uninterrupted between hardware failures and power outages. It's common to see FreeBSD machines that have been running well over a year without a reboot, and most outages are due to hardware or power failures.
Moreover, FreeBSD tends to dominate the longest uptime category in Netcraft's WEB surveys.
For current stats:
Most reliable sites
Longest uptimes
FreeBSD has also been the OS of choice by many popular WEB servers, such as yahoo.com, cdrom.com, and hotmail.com. For a history of the OS, see the Wikipedia article.

Support

One of the most common concerns of many would-be FreeBSD users is support. People often assume that since they haven't heard more about the product, it must not be widely used. Not to worry - the FreeBSD community is HUGE, and quite helpful. People often state that Linux is more popular than FreeBSD. While this is almost certainly true, it is not a valid comparison. FreeBSD is a complete system, more akin to a Linux distribution than to Linux in general, and probably has a larger user base than all but the top few Linux distributions. The term "Linux" refers only to the Linux kernel project, around which the many different Linux distributions are built. When it comes to user support, users of the same distribution can be much more helpful than someone just using the same kernel. I.e., RedHat users, despite their best intentions, are somewhat limited in their ability to help you with many questions about your Gentoo or Debian system.
The bottom line is, with FreeBSD, there will be a lot of people using the same complete system as you. Hardware support is very strong, problems are few, and solutions tend to be well publicized. Some companies also offer paid support services for FreeBSD.

FreeBSD and Windows Applications

If you need to run Windows applications as well, I recommend Win4BSD, the latest port of a virtualization system also known as SCO Merge and Win4Lin. Win4BSD is a solid commercial product at a very reasonable price. It's extremely simple to install and use, and runs Windows applications at nearly native speed. If you find this, or any other commercial product useful, please do buy a copy, to encourage future development of commercial applications for FreeBSD and Linux.

Win4BSD 1.1 running Windows XP on a FreeBSD 5.4 desktop

Win4{BSD,Lin} is comparable to Parallels for the Intel Mac, (another solid product) in that it allows you to boot Windows 2000 or XP as a "guest" operating system, which will run at nearly native speed within your FreeBSD host. Setup is a snap, and your virtual Windows system will be ready to use and fully integrated with the host the moment you finish installing Windows. Win4BSD leverages code from the QEMU project, but is much faster and easier to use than the qemu port. It's well worth the modest purchase price.
One advantage of Win4{BSD,Lin} over Parallels on the Mac is that a Windows session can be run from a remote X11 display (e.g. another FreeBSD system, a Linux system, or even a Mac). The GUI may be a bit sluggish over a network, but if the network is 100baseT or more, it's fast enough that it won't delay your work.
Parallels, on the other hand, is an Aqua application, so it can only be run on the Mac console. The GUI is visibly faster than Win4BSD, since Aqua always uses direct hardware rendering vs. X11's client/server model. However, I would consider this more of a cosmetic difference than a functional one. The Win4BSD graphics are fast enough, especially on the console of a modern FreeBSD machine. In theory, you could run Parallels remotely through VNC or Apple Remote Desktop, but performance of these systems is much slower than X11. Windows is unusably slow even over a 100 megabit network with VNC. Another disadvantage of VNC and ARD are that they take over the console rather than allow a separate login session as X11 does. Hence, no one can use the Mac console while you're remotely logged in over VNC or ARD.
If you want to be able to run Windows from a remote display, you'll want to get a FreeBSD or Linux system and run Win4{BSD,Lin}.
Note also that Mac OS X and Parallels are rather memory hungry compared to FreeBSD and Win4BSD, so you'll need to spend more on RAM for your Mac in order to run a Windows guest comfortably. A Mac with 512 megabytes just won't cut it for Parallels, while a FreeBSD box with 512 megabytes does just fine with Win4BSD.





Quick Comparison

Win4BSDParallels Desktop for Mac

Min requirements, Windows XP guest1.4GHz Athlon/Pentium, 512 megabytes RAMIntel Mac, 1 gig RAM

CPU speedNear nativeNear native

GUI responsivenessAdequateGood

Run from a remote displayYesNo

Ease of setupVery easyVery easy

Running Windows applications under a guest operating system
isn't quite as elegant as running OS X
native MS Office, Adobe, etc., but the Win4BSD system integrates very
well with the FreeBSD host.


Other alternatives for emulation and/or virtualization include
VMware, QEMU, and WINE. None of these are as easy to use or efficient
as Win4BSD, however.


WINE also operates quite differently. While the others emulate (or
virtualize) PC hardware, WINE attempts to emulate the Windows API
(applications program interface), allowing Windows programs to run
directly under Unix. This is a much more ambitious task than just
emulating hardware, given that much of the complexity of the Windows
OS must be duplicated. Not to mention that the API is constantly
changing. The advantage is that no Windows OS needs to be purchased
or running in order to run Windows applications. They simply run on
the same Unix desktop as other applications.

Despite the difficulty of the task, the WINE project has made significant progress, and some
major Windows applications can now be run under Linux, FreeBSD, and
other Intel based operating systems.

Reference:
http://www.neuro.mcw.edu/Ports/FreeBSD/why_freebsd.html