วันพฤหัสบดี, ธันวาคม 26, 2556

OSX: Solution: Virtualbox 4.x bridged network not working on OSX 10.9 Mavericks

Thai: แก้ปัญหา Virtualbox 4.2, 4.3 ใช้ bridged network บน OSX 10.9 ไม่ได้ 

    I'm using Virtualbox 4.2, 4.3 with OSX 10.9 the bridged network not working. The error message look like this 
'HostInterfaceNetworking-en0' (VERR_SUPDRV_COMPONENT_NOT_FOUND). 

    I'm googled, someone said if we uninstall and re-install it the problem will gone, but it's not working for me, after several reboot the problem still arise. 

    So, this is another solution. By using this script before start the Virtualbox would help/solve the problem :) 

#!/bin/bash
 
unload() {
  sudo ifconfig bridge0 down
  sudo ifconfig bridge0 unplumb
  kextstat | grep "org.virtualbox.kext.VBoxUSB" > /dev/null 2>&1 \
  && sudo kextunload -b org.virtualbox.kext.VBoxUSB
  kextstat | grep "org.virtualbox.kext.VBoxNetFlt" > /dev/null 2>&1 \
  && sudo kextunload -b org.virtualbox.kext.VBoxNetFlt
  kextstat | grep "org.virtualbox.kext.VBoxNetAdp" > /dev/null 2>&1 \
  && sudo kextunload -b org.virtualbox.kext.VBoxNetAdp
  kextstat | grep "org.virtualbox.kext.VBoxDrv" > /dev/null 2>&1 && \
  sudo kextunload -b org.virtualbox.kext.VBoxDrv
}
 
load() {
  sudo kextload /Library/Extensions/VBoxDrv.kext -r /Library/Extensions/
  sudo kextload /Library/Extensions/VBoxNetFlt.kext -r /Library/Extensions/
  sudo kextload /Library/Extensions/VBoxNetAdp.kext -r /Library/Extensions/
  sudo kextload /Library/Extensions/VBoxUSB.kext -r /Library/Extensions/
  sudo ifconfig bridge0 plumb
  sudo ifconfig bridge0 inet 192.168.2.1 netmask 255.255.255.0 broadcast 192.168.2.255 up
}
 
case "$1" in
  unload|remove)
    unload
    ;;
  load)
    load
    ;;
  *|reload)
    unload
    load
    ;;
esac


the script was from this blog. I believed that the original script was from here, forums.virtualbox.org but this one is the improved & working one :)

วันอังคาร, ธันวาคม 24, 2556

OSX: Using Subversion 1.7 with OSX 10.9 Mavericks (use Wandisco distribution not port nor brew)

Thai: วิธีติดตั้ง subversion 1.7 ใน OSX 10.9 (Mavericks) ไม่ใช้ port หรือ brew

updated on 3 Jan 2014 : fix wrong path.

There's no Subversion package build for OSX 10.9 from the Wandisco website, and also else where.

I accidentally found this information, able to use 10.8's pkg to successfully install on 10.9.

1. Download vanilla Subversion from their website here.

2. Choose this link "Download Subversion 1.7.13 for OSX 10.8.x Client Only"

3. We will get a file, named look like this: Subversion-Client-1.7.13_10.8.x.pkg

4. Copy to home folder. Using Terminal
$cd 
$cp Subversion-Client-1.7.13_10.8.x.pkg ~/
(assume that we place the downloaded file in the home folder)

5. create a script on home folder
$cd ~/
use vi command or any familiar text editor
$vi svninstall.sh 

insert this code
#!/bin/sh -x

PKG_NAME=Subversion-Client-1.7.13_10.8.x.pkg

pkgutil --expand ${PKG_NAME} /tmp/${PKG_NAME}
/tmp/${PKG_NAME}/subversion.pkg/Scripts/preinstall
pushd /tmp/${PKG_NAME}/subversion.pkg
tar xf Payload
sudo mv opt/subversion /opt
popd
/tmp/${PKG_NAME}/subversion.pkg/Scripts/postinstall
rm -rf /tmp/${PKG_NAME}

use :wq save and quit the vi

6. make it executable
$chmod +x svninstall.sh

7. execute the script to install the subversion
$./svninstall.sh

The output look like this 
$./svninstall.sh

+ PKG_NAME=Subversion-Client-1.7.13_10.8.x.pkg
+ pkgutil --expand Subversion-Client-1.7.13_10.8.x.pkg /tmp/Subversion-Client-1.7.13_10.8.x.pkg
+ /tmp/Subversion-Client-1.7.13_10.8.x.pkg/subversion.pkg/Scripts/preinstall
+ pushd /tmp/Subversion-Client-1.7.13_10.8.x.pkg/subversion.pkg
/tmp/Subversion-Client-1.7.13_10.8.x.pkg/subversion.pkg ~/Temp
+ tar xf Payload
+ sudo mv opt/subversion /opt
+ popd
~/Temp
+ /tmp/Subversion-Client-1.7.13_10.8.x.pkg/subversion.pkg/Scripts/postinstall

+ rm -rf /tmp/Subversion-Client-1.7.13_10.8.x.pkg

$

8. check if we it's successfully installed
$ svn --version
svn, version 1.7.10 (r1485443)
   compiled Aug 13 2013, 15:31:22
...

from: wandisco's svnforum

วันจันทร์, สิงหาคม 19, 2556

OS X: Using (downgrade) Subversion 1.7 with macports on OS X 10.8

    With the latest update port 2.2.0 it came with subversion 1.8 which I don't need it right now. After googling for a while, here's how to downgrade.


$port installed subversionThe following ports are currently installed:
  subversion @1.7.8_1
  subversion @1.7.8_2
  subversion @1.7.9_1
  subversion @1.7.10_1
  subversion @1.8.1_3 (active)

$port installed subversion-*The following ports are currently installed:
  subversion-javahlbindings @1.7.9_0
  subversion-javahlbindings @1.7.10_0
  subversion-javahlbindings @1.8.1_2 (active)

$port installed serf*The following ports are currently installed:
  serf1 @1.1.1_0
  serf1 @1.2.0_0
  serf1 @1.2.0_0+universal
  serf1 @1.2.1_0+universal
  serf1 @1.3.1_0 (active)
  serf1 @1.3.1_0+universal


** If there's not serf1 installed, execute "sudo port install serf1" to install it.


Execute this command to downgrade to Subversion 1.7 with java-hl support
$sudo port activate subversion @1.7.10_1 subversion-javahlbindings @1.7.10_0 serf1 @1.2.0_0

note: the version number might different than mine.



To check if we already able to use subversion 1.7 ; execute this command

$svn help | lessusage: svn <subcommand> [options] [args]
Subversion command-line client, version 1.7.10.

Type 'svn help <subcommand>' for help on a specific subcommand.

Reference: comment#1 in downgrading-subversion-from-1-8-to-1-7-in-macports

วันอังคาร, มีนาคม 26, 2556

ปรับแต่ง Eclipse Indigo Optimize JVM settings


ตั้งใจบันทึกไว้ใช้ส่วนตัว (•‿•) 

     คุณ Mikko เค้าบอกเอาไว้ใน stackoverflow ว่า settings นี้  ตั้งใจให้ eclipse มันใช้ mem น้อยๆ และลดความหน่วงลงในทุกกรณี. ส่วนตัวเองก็ไม่แตกฉานเรื่อง JVM ก็เลย จดและจำนำมาใช้
    แต่ละ option, ดูเครื่องหมายลบ จะอยู่บรรทัดใครบรรทัดมัน อยู่บรรทัดเดียวกันไม่ได้นะครับ

แก้ไข eclipse.ini เป็นแบบนี้ ( ทดลองเอาไปใช้กับ eclipse ใน OSX 10.8 ก็ start มาใช้งานได้ไม่มีปัญหา, มันก็ใช้ Sun JDK เหมือนกันนี่นะ)

Eclipse Indigo 3.7.2 settings (64 bit linux)

Settings for Sun/Oracle java version "1.6.0_31" and Eclipse 3.7 running on x86-64 Linux:

-nosplash
-vmargs
-Xincgc
-Xss500k
-Dosgi.requiredJavaVersion=1.6
-Xms64m
-Xmx200m
-XX:MaxPermSize=150m
-XX:NewSize=8m
-XX:PermSize=80m
-XX:MaxPermSize=150m
-XX:MaxPermHeapExpansion=10m
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=70
-XX:+UseCMSInitiatingOccupancyOnly
-XX:+UseParNewGC
-XX:+CMSConcurrentMTEnabled
-XX:ConcGCThreads=2
-XX:ParallelGCThreads=2
-XX:+CMSIncrementalPacing
-XX:CMSIncrementalDutyCycleMin=0
-XX:CMSIncrementalDutyCycle=5
-XX:GCTimeRatio=49
-XX:MaxGCPauseMillis=20
-XX:GCPauseIntervalMillis=1000
-XX:+UseCMSCompactAtFullCollection
-XX:+CMSClassUnloadingEnabled
-XX:+DoEscapeAnalysis
-XX:+UseCompressedOops
-XX:+AggressiveOpts
-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses

Note that this uses only 200 MB for the heap and 150 MB for the non-heap. If you're using huge plugins, you might want to increase both the "-Xmx200m" and "-XX:MaxPermSize=150m" limits.
The primary optimization target for these flags has been to minimize latency in all cases and as a secondary optimization target minimize the memory usage.

ผมจะ mix-up มันนิดนึงคือเปลี่ยน เป็นแบบนี้สำหรับ 2-3  บรรทัดนี้ (จาก sof: 7776565)


-XX:MaxPermSize=256m
-Xms128m
-Xmx512m


เอามาจาก (This is from):
http://stackoverflow.com/a/7822155
  และ
http://stackoverflow.com/a/7776565

วันจันทร์, มีนาคม 18, 2556

แก้ปัญหา macbook (osx) มีชื่อเครื่อง (hostname) เปลี่ยนไปเรื่อยๆ

Fixing OSX Mountain Lion show the incorrect hostname in the terminal application

    ทำงานที่ออฟฟิส เครือข่ายภายในเค้าจะมี proxy server, DNS server, DHCP server ที่ตั้งขึ้นมาใช้งานกันภายใน.

    ผมเป็นคนที่ต้องใช้งาน Terminal บ่อย เวลาเปิด Terminal app/iTerm 2 ขึ้นมา



 hostname ที่ตั้งเอาไว้ใน Network Preference มันใช้งานไม่ได้เลย (sinb-56-001)


 หรือจะบอกว่ามันไม่เคยได้ชื่อ hostname ที่ตั้งเอาไว้เลย
จะได้

SPTNB-54-002:~ siritas_s$ 
หรือ
EPNB-54-002:~ siritas_s$ 
หรืออื่นๆอีกมากมาย

เคยคุยกับ Network admin เค้าบอกว่ามันเป็นที่ตัว AD (Active directory) มั้งนะ ทางแก้ทางนึงคือเค้าจะต้องมาคอย clean ชื่อเหล่านี้ทิ้งซะ ซึ่งมันเยอะและเสียเวลา

ผมว่ามันน่ารำคาญ แต่ก็ยังไม่เห็นผลลัพธ์อันร้ายแรงจากปัญหานี้ แต่ก็พยายามลองหาทางแก้อื่น ตอนนี้เจอแล้ว

Solution วิธีแก้ 
ให้ใช้ Terminal app แก้ไขไฟล์ /etc/hostconfig ตามนี้

i.e.:
$sudo vi /etc/hostconfig

ให้แก้
HOSTNAME=-AUTOMATIC-
เปลี่ยนจาก -AUTOMATIC- เป็นชื่อที่อยากใช้ได้เลย

หรือถ้าไม่มีบรรทัด HOSTNAME นี้ก็เพิ่มเข้าไปเองได้เลย
i.e.
HOSTNAME=SINB-56-001

ทดลอง restart เครื่อง/ restart OSX ดูก่อน

ถ้ายังแก้ไม่ได้ให้ลองดูไฟล์ /Library/Preferences/SystemConfiguration/preferences.plist ว่ามีการอ้างถึง hostname ที่ไม่ถูกต้องอยู่อีกหรือไม่ ถ้ามีก็แก้ไขซะแล้ว restart อีกครั้ง

คราวนี้น่าจะแก้ไขกันได้แล้ว :) ผมทดลองแล้ว (กับ OSX 10.8.x/Mountain Lion) แก้ไขได้ปัญหาไม่เกิดขึ้นอีก

ref: http://excitedcuriosity.wordpress.com/2007/08/24/mac-os-x-hostname-determination/

วันศุกร์, มีนาคม 15, 2556

youtube-dl recipe: รวมคำสั่งโหลด Youtube video มาเก็บไว้ดู

ตั้งชื่อตอนว่า Youtube-dl Recipe; รวมสูตรคำสั่งของ youtube-dl

    youtube-dl เป็นโปรแกรมเขียนด้วยภาษา python เอาไว้ดาวโหลด youtube video  มาเก็บเอาไว้เป็นไฟล์ flv หรือ mp4; ประโยชน์ที่ผมชอบมัน 
  1. ดูซ้ำได้โดยไม่ต้อง online
  2. ดูแบบลื่นไหลไม่สะดุด
  3. แถมยังหากเป็นไฟล์ที่มี cc (close caption) หรือ ซับไตเติ้ล (subtitle) ก็ยังโหลดมาเป็นไฟล์ .srt เล่นแบบแสดง subtitle ได้ด้วย 
   ตัวโปรแกรม youtube-dl เป็น open source โหลดได้จาก github.com/rg3/youtube-dl ตัวมันรันได้ทุก platform (Windows, Linux, Mac OSX) ที่มี/ติดตั้ง python 2.6 ขึ้นไปเอาไว้ 

คำสั่งที่ผมชอบใช้ 

1.โหลดที่ละหลายๆเรื่อง
    โหลด youtube โดยเอา URL ใส่ไว้ใน text file (ep12.txt) ใช้ในกรณีอยากโหลดละคร(series) ที่ upload เป็นหลายๆส่วน (เช่น 1/7- 7/7)
$python youtube-dl.py -v --format 18 -o '%(title)s.%(ext)s' --batch-file <file>

ตัวอย่าง  
$python youtube-dl.py -v --format 18 -o '%(title)s.%(ext)s' --batch-file <file>

--format 
    ใส่เลข itag; คือ format ของ video ที่เราต้องการ ดูรายละเอียดได้จาก wikipedia Youtube
ที่ผมชอบใช้ ถ้าเป็นละครทีวีไทย ใช้ 18 ก็พอ ถ้าเป็นพวกไฟล์ keynote ของตปท.หรือ music video ก็จะใช้ 22 หรือ 37
tag = Container | Video Resolution | Video encoding| Audio encoding
18 = mp4 | 270p/360p | H.264| AAC
22 = mp4 | 720p | H.264| AAC
37 = mp4 | 1080p | H.264| AAC

-o
บอกมันว่าจะ save แล้วตั้งชื่อไฟล์อย่างไร %(title)s.%(ext)s คือใช้ชื่อเรื่องของ youtube นั้นแล้ว ext ก็เป็นไปตาม itag ที่เลือก

--batch-file <ep12.txt>
บอกว่าให้ไปดู URL จาก file ที่ให้ไปโดยเนื้อหาข้างในก็เป็น 1 URL 1 บรรทัด

2.โหลดแบบเอา subtitle ด้วย
$python youtube-dl.py --format <##> -o %(title)s.%(ext)s --write-srt URL
ตัวอย่าง 
$python youtube-dl.py --format 22 -o %(title)s.%(ext)s --write-srt vXTXmq5z2tM
--write-srt
บอกให้มัน save subtitle หรือ cc มาให้ด้วย,ถ้ามี

3.โหลดแบบ simple simple 
ใช้ค่า default ทุกอย่าง
$python youtube-dl.py URL
ตัวอย่าง
$python youtube-dl.py vXTXmq5z2tM

Note: 
  • ถ้ารันบน OSX parameter -o ต้องใส่ single quote ครอบด้วย เช่นนี้ -o '%(title)s.%(ext)s'
  • URL ไม่ต้องมี http:// หรือ youtube.com เอา id ของมันมาใส่ได้เลย หากดาวโหลดจาก youtube อยู่แล้ว 
  • ถ้าใช้ linux หรือ osx ทำ alias ไว้เลยครับ เช่น
    alias youtube-dl='python ~/script/youtube-dl/youtube-dl.py'
  • ถ้าวัันดีคืนร้าย รันแล้วไม่ยอมโหลดให้ลอง update program ดูก่อนใช้คำสั่ง
    $youtube.dl -U

ลองหาอ่านเพิ่มเติมได้ที่ https://github.com/rg3/youtube-dl/#readme
หรือจะพิมพ์ youtube-dl -h ก็ได้ ^^

PS. If you want to read Thai please try to use Google Translate. (I embedded the tools, find it on the right.

วันพุธ, มีนาคม 13, 2556

Ubuntu: วิธีตั้ง proxy server ส่วนตัวด้วย tinyproxy / Setup a personal proxy with tinyproxy

วันนี้นำเสนอการตั้ง proxy ส่วนตัว บน Ubuntu OS แบบง่ายๆด้วย tinyproxy
สถานการณ์ของผม

  1. มีเครื่อง ก: laptop/desktop เครื่องหนึ่งที่ออก internet ไม่ได้ อยู่วงแลนที่ไม่มี internet; สมมติว่า มี IP address เป็น 192.168.10.12
  2. ถ้าเครื่อง (ข) laptop/desktop ที่อยู่แลนอีกวงนึงจะสามารถออก internet ได้เลย; สมมติว่า มี IP address เป็น 192.168.50.12

    ไอ้การที่จะเปลี่ยน IP ของเครื่องไปๆมาๆเพื่อออก internet นี่มันไม่สะดวกครับ ผมจึงคิดว่าทำเครื่องนึงให้เป็น IP ที่อยู่ในวง .50 ซะแล้ว share internet ด้วย proxy; เพื่อให้เครื่อง 192.168.10.12 มันสามารถออกเนตได้

เครื่อง ข จะเป็นเครื่องที่ทำตัวเองเป็น proxy เริ่มกันเลย

ติดตั้ง software tinyproxy ตัวนี้มีอยู่ใน universe repository อยู่แล้วครับ.
$sudo apt-get install tinyproxy
ทำการปรับแต่ง configuration ของ tinyproxy (ที่ใช้อยู่ตอนนี้คือ version 1.8.3-1)
$sudo vi /etc/tinyproxy.conf

คำค้นสำคัญๆที่เราสนใจ,ในเบื้องต้นนี้คือ
...
Port 8888 //ตัวนี้กำหนดว่า proxy เราจะใช้ port อะไร
...

...
Allow 127.0.0.1
#Allow 192.168.0.0/16
...

ให้เราแก้ไขเป็น,โดยเอา comment ออก

...
Allow 127.0.0.1
Allow 192.168.0.0/16
...

จัดการ save ที่เราแก้ไขเอาไว้
:wq

ทำการ restart tinyproxy service ซะหน่อย ให้มันอ่าน config ที่เราเพิ่งแก้ไขไป
$sudo service tinyproxy restart

Config Browser ที่เครื่อง ก.
เช่น Firefox ให้มาใช้งาน proxy ของเรา

Firefox network setting

Firefox proxy dialog


ถ้าใช้งานได้ก็เป็นอันใช้ได้ :)  แบบนี้














blog ต่อไปจะมาเล่าให้ฟังว่าทำให้มัน secure กว่านี้ได้อย่างไร (เรียกใช้ proxy ผ่าน SSH :) )


วันเสาร์, มีนาคม 09, 2556

6 Things (or more) to do after buy a new macbook pro

    This blog post kind of instruction but I will not provide all of the details, it's just like the collections of knowledge to do such a things.


1. Buy a Solid state drive (SSD) install it into the macbook.

    I was bought OCZ Agility 3, NOTICE! there's a problem with the OSX 10.8 if it was installed as a second drive; not replace the HDD bay. So, please study/find information as much as you can that which model work flawlessly with OSX 10.8 ;) 

    iFixit website provide the instruction on how to replace the macbook pro's HDD.
here is the link of my model "macbook pro unibody mid 2012"

   I desired to install SSD along with the HDD. Start the OSX with SSD and keep the data in the HDD. To do this I need a accessory called "OptiBay" or "Optical Bay" you can google with that keyword ;) if you want one.

   The Optical bay will replace the macbook's optical drive (the DVD drive). Again, I find the how to took the optical drive off from the iFixit website. Replace the DVD drive with the Optical bay with the HDD inside.
   
    Check the new hardware installation; after install the SSD & the Optical bay (with HDD).  Turn on the macbook; hold on the Command button, to select disk to boot. We must select the MacintoshHD disk.

   Time to install an OSX into a new SSD :) 

2. Install fresh OSX Mountain Lion into the new SSD. with/from a Flashdrive.

    We already remove the DVD drive so we need a flashdrive to install a fresh OSX, The Mountain Lion. I successful with the instruction from the osxdaily.com website.

    BTW, You will need following things, to complete this bullet:
  • a Flashdrive, at least 8GB.
  • an OSX Mountain Lion copy, ISO or DVD.
3. Move the User's home to the HDD.

    This is one of many thing to tweak and it's best for SSD life. You can find the instruction and the more SSD tweaks from this website, "optimizing macosx lion for ssd".

4. NTFS disk/partition auto mount/unmount, so I can use External HDD, Flashdrive with the Window machine.
    
    I successful do this with the instruction from this website https://fernandoff.posterous.com/ntfs-write-support-on-osx-lion-with-ntfs-3g-fntfs-write-support-on-osx-lion-with-ntfs-3g-f

That was on posterous.com, afraid that some day it might disappeared so I do made a note, what I had done to succeed. (In Thai)

Write/Read in 10.8, 10.7 using MacPorts
ref: https://fernandoff.posterous.com/ntfs-write-support-on-osx-lion-with-ntfs-3g-f
ดูตามหัวข้อ Fuse4x + NTFS-3G from MacPorts 

Summary step:
  1. ลง Fuse4x-0.9.2.dmg ก่อนแล้วตามด้วย  NTFS-3G.dmg *ไม่ต้องลง macports ถ้าลงแบบใช้ dmg ข้าม port selfupdate ฯ ไปเลย
  2. แก้ไข script, /sbin/mount_ntfs
  3. NOTE: ให้ลองตรวจสอบว่า ntfs-3g ที่ลง ลงไปที่ /opt/local/bin/ntfs-3g ตาม guide หรือไม่แต่ตอนที่ทำสำเร็จมันไปอยู่ที่ /usr/local/bin/ntfs-3g 
  4. สามารถใช้คำสั่ง (at Terminal app) $which ntfs-3g เช็ค มันจะแสดง absolute path มันออกมา 
  5. ถ้าไม่ใช่ /opt ก็กลับไปแก้ที่ script ก่อน
  6. จากนันให้ทดลองเรียก ntfs-3g ที่ terminal มันจะถามว่าอยากจะให้ automount หรือไม่ ตอบ Y 
  7. restart OS ครั้งนึง กลับเข้ามาอีกที เสียบ ext HDD ที่เป็น ntfs มันน่าจะ mount แบบทั้ง read/wri้te ได้
5. Learn the OSX Tips & Trick.
  
    Time to learn more about the OSX, learn some tricks, tips that might help my productivity.

วันพฤหัสบดี, มีนาคม 07, 2556

HOWTO: Using Subversion 1.6 with OSX 10.8, downgrade svn 1.7 to 1.6

วิธีใช้งาน Subversion 1.6.x กับ OSX 10.x หรือลด version จาก 1.7 เป็น 1.6

(ทดสอบแล้วกับ OSX 10.8)

    ผมใช้ osx 10.8 และติดตั้ง macports หรือ port เอาไว้ด้วย ติดตั้ง nmap แล้วมันลง subversion 1.7 แถมมาให้ด้วย แต่ทีนี้ projects/source codes ทั้งหลายที่ทำงานอยู่ยังคงต้องใช้ svn 1.6; (ผมจะใช้ keyword svn แทน subversion มันสั้นกว่า ^^) เนื่องจากผมใช้ svnant ด้วย, ตัว svnClientAdapter เค้ายังไม่รองรับ svn 1.7 จึงยังคงต้องใช้ svn client 1.6 อยู่


   ขั้นแรก เราต้องมี svn client version 1.6 ซะก่อน ไปดาวโหลดได้จาก website ของ Wandisco เลยครับ Vanilla Subversion 1.6.20 & 1.7.8 certified by WANdisco มี certified แปะไว้ด้วย วิธีติดตั้งก็ง่ายๆ เค้าทำเป็น pkg ไว้แล้ว ทำเหมือนติดตั้ง package อื่นๆของ osx เลยครับ
   พอติดตั้งเสร็จเค้าจะบอกให้เราเพิ่ม path เข้าไปที่ .profile ของเราด้วย ประมาณนี้
...
export PATH=/opt/subversion/bin:$PATH
... 

   ถ้าเรียก terminal ขึ้นมาอีกครั้ง, หลังจากเพิ่ม PATH เข้าไปแล้ว เมื่อสั่ง svn help เราจะได้ประมาณนี้ 

$ svn --version
svn, version 1.6.18 (r1303927)
   compiled Nov  2 2012, 23:47:41

Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.apache.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).
แสดงว่าเรามี svn version 1.6 ติดตั้งแล้ว 

  ถ้าคุณเหมือนผมคือติดตั้ง nmap ผ่านทาง macports หรือใช้ macports แล้วมันดันติดตั้ง svn 1.7 ให้ หากเรียกด้วยคำสั่งก่อนหน้านี้ มันจะแสดงเลข version เป็น 1.7 

ส่วนวิธีเอาออกก็ทำแบบนี้

ทดสอบดูก่อนว่ามี svn ทีถูกติดตั้งโดย port

$port installed subversion
The following ports are currently installed:
  subversion @1.7.8_1
  subversion @1.7.8_2 (active) 

สังเกตทีี (active) แสดงว่ามันถูกใช้งานอยู่ ปิดหรือ de-active ได้ด้วยคำสั่ง 

$ sudo port deactivate subversion @1.7.8_2
Password:
--->  Deactivating subversion @1.7.8_2
--->  Unable to deactivate subversion @1.7.8_2, the following ports depend on it:
--->   nmap @6.25_1
Error: org.macports.deactivate for port subversion returned: Please uninstall the ports that depend on subversion first.
Please see the log file for port subversion for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_registry_portfiles_subversion_1.7.8_2/subversion/main.log
Warning: Failed to execute portfile from registry for subversion @1.7.8_2
--->  Deactivating subversion @1.7.8_2
--->  Unable to deactivate subversion @1.7.8_2, the following ports depend on it:
--->   nmap @6.25_1
Error: port deactivate failed: Please uninstall the ports that depend on subversion first.

จะเห็นว่าครั้งแรกมันจะไม่ยอมปิดให้เรา เพราะ nmap ต้องใช้ ผมเลยตัดใจไม่ใช้ nmap ด้วยสั่งใหม่ดังนี้ 

$ sudo port deactivate nmap @6.25_1 subversion @1.7.8_2
--->  Deactivating nmap @6.25_1
--->  Cleaning nmap
--->  Deactivating subversion @1.7.8_2
--->  Cleaning subversion

ทดสอบดูอีกว่ามี svn ทีถูกติดตั้งโดย port? จะเห็นว่ามันไม่(มี) active แล้ว
$ port installed subversion
The following ports are currently installed:
  subversion @1.7.8_1
  subversion @1.7.8_2

สบายใจ เมื่อสั่ง svn ทีนี้จะเป็นคำสั่งของ version 1.6 แล้วหล่ะครับ