Lifehacker hints on how to get your external IP-address from the command line. You can use either curl or wget, using either of the following commands:
curl -s myip.dk |grep '"Box"' | egrep -o '[0-9.]+'
wget -O - -q myip.dk |grep '"Box"' | egrep -o '[0-9.]+'
OS X do not come with wget preinstalled (it can be installed through e.g. Fink or MacPort), the curl version might be the most useful for OS X users.