RSS
 

Posts Tagged ‘Macintosh’

在蘋果用命令列建立 CD/DVD .iso image

05 May

1. 取得 DVD 在 /dev/ 的磁碟代號.
$ drutil status

Vendor Product Rev
MATSHITA DVD-R UJ-8A8 HA13

Type: DVD-ROM Name: /dev/disk1
Sessions: 1 Tracks: 1
Overwritable: 00:00:00 blocks: 0 / 0.00MB / 0.00MiB
Space Free: 00:00:00 blocks: 0 / 0.00MB / 0.00MiB
Space Used: 601:20:16 blocks: 2706016 / 5.54GB / 5.16GiB
Writability:
Book Type: DVD-ROM (v1)

2. 從上列命令得知. DVD 的代號為 /dev/disk1. 再用下列命令卸載 DVD
$ diskutil unmountDisk /dev/disk1

Unmount of all volumes on disk1 was successful

3. 用 dd 指令匯出 iso 檔案. 需要花一段時間
$ dd if=/dev/disk1 of=DVD.iso bs=2048

2706016+0 records in
2706016+0 records out
5541920768 bytes transferred in 1599.459628 secs (3464871 bytes/sec)

4. 測試掛載剛剛做好的 .iso image, 可以用 Finder 直接在DVD.iso檔案上按兩下就能順利掛載.
$ hdid DVD.iso

相關閱讀 : 轉換 .dmg 為 .iso

 
 

HOWTO Setup Mac OS X L2TP VPN Server

12 Jun

首先, 先變成管理者模式

# sudo -s

在 /Library -> Preferences -> SystemConfiguration 建立 com.apple.RemoteAccessServers.plist 檔案

# vi /Library/Preferences/SystemConfiguration/com.apple.RemoteAccessServers.plist

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>ActiveServers</key>
        <array>
                <string>com.apple.ppp.l2tp</string>
        </array>
        <key>Servers</key>
        <dict>
                <key>com.apple.ppp.l2tp</key>
                <dict>
                        <key>DNS</key>
                        <dict>
                                <key>OfferedSearchDomains</key>
                                <array/>
                                <key>OfferedServerAddresses</key>
                                <array>
                                        <string>168.95.1.1</string>
                                        <string>168.95.192.1</string>
                                </array>
                        </dict>
                        <key>IPv4</key>
                        <dict>
                                <key>ConfigMethod</key>
                                <string>Manual</string>
                                <key>DestAddressRanges</key>
                                <array>
                                        <string>192.168.x.101</string>
                                        <string>192.168.x.120</string>
                                </array>
                                <key>OfferedRouteAddresses</key>
                                <array/>
                                <key>OfferedRouteMasks</key>
                                <array/>
                                <key>OfferedRouteTypes</key>
                                <array/>
                        </dict>
                        <key>Interface</key>
                        <dict>
                                <key>SubType</key>
                                <string>L2TP</string>
                                <key>Type</key>
                                <string>PPP</string>
                        </dict>
                        <key>L2TP</key>
                        <dict>
                                <key>IPSecSharedSecret</key>
                                <string>com.apple.ppp.l2tp</string>
                                <key>IPSecSharedSecretEncryption</key>
                                <string>Keychain</string>
                                <key>Transport</key>
                                <string>IPSec</string>
                        </dict>
                        <key>PPP</key>
                        <dict>
                                <key>AuthenticatorProtocol</key>
                                <array>
                                        <string>MSCHAP2</string>
                                </array>
                                <key>LCPEchoEnabled</key>
                                <integer>1</integer>
                                <key>LCPEchoFailure</key>
                                <integer>5</integer>
                                <key>LCPEchoInterval</key>
                                <integer>60</integer>
                                <key>Logfile</key>
                                <string>/var/log/ppp/vpnd.log</string>
                                <key>VerboseLogging</key>
                                <integer>1</integer>
                        </dict>
                        <key>Server</key>
                        <dict>
                                <key>Logfile</key>
                                <string>/var/log/ppp/vpnd.log</string>
                                <key>MaximumSessions</key>
                                <integer>128</integer>
                                <key>VerboseLogging</key>
                                <integer>1</integer>
                        </dict>
                </dict>
        </dict>
</dict>
</plist>

記得把 OfferedServerAddresses裡面的值改成你要指定的dns server位址. 還有把 DestAddressRanges 內的值改成你要發放的 IP 位址

指定 root:wheel 到 com.apple.RemoteAccessServers.plist檔案

# chown root:wheel /Library/Preferences/SystemConfiguration/com.apple.RemoteAccessServers.plist

建立好vpn的log檔案

# touch /var/log/ppp/vpnd.log

設定 secret 密碼到 system keychian

security add-generic-password -a com.apple.ppp.l2tp -s com.apple.net.racoon -p “TOP_SECRET” /Library/Keychains/System.keychain

打開 Utilities -> Keychain Access 程式 右上方 搜尋 racoon

點選”Access Control” Tab

打勾”Allow all applications to access this item”

設定撥號進來的帳號密碼 :

# vi /etc/ppp/chap-secrets

1
2
3
# Secret for authentication using CHAP
# client    server   secret        IP addresses
"YOUR_ACCOUNT" * "YOUR_PASSWORD" *

記得將 YOUR_ACCOUNT & YOUR_PASSWORD 改成你要設定的帳號密碼.

然後啟動vpn

# vpnd

這樣vpn就能運作了

如果你要讓vpn每次開機都啟動, 就要編輯下列檔案

# vi /System/Library/LaunchDaemons/com.apple.ppp.l2tp.plist

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>com.apple.ppp.l2tp</string>
        <key>OnDemand</key>
        <false/>
        <key>Program</key>
        <string>/usr/sbin/vpnd</string>
        <key>ProgramArguments</key>
        <array>
                <string>vpnd</string>
                <string>-x</string>
                <string>-i</string>
                <string>com.apple.ppp.l2tp</string>
        </array>
        <key>ServiceIPC</key>
        <false/>
</dict>
</plist>

可以用下列指令測試是否可以載入 vpnd

launchctl load /System/Library/LaunchDaemons/com.apple.ppp.l2tp.plist

 
1 Comment

Posted in Macintosh

 

[iPhone] Alarm Clock Radio ✓

10 Apr

難得有軟體我一試用就直接買了. 它有個免費版本可以用 Clock Radio Free ✓. 這個版本其實已經算不錯用了. 只是想說要支持一下這麼好用的軟體我就花0.99美金買了 . 有人問說這兩個版本有什麼不同. 我認為唯一的差別是可以播放手機裡面的 Music Library. 其他都看起來相同. 它內建的網路音樂頻道滿豐富. 不多說.直接截圖 :


這是我愛聽的網路廣播頻道
SKY.FM Solo Piano


可以播放iPhone內的Music Library. 還有專輯封面喔


可以調整亮暗


最暗可以按到這種程度.不如按一下睡眠按鈕 :P


這軟體的缺點就是不能顯示中文.有點殘念阿.

 
 

pTunes Widget 0.1 (Preview)

24 Jan

一切還沒完成. 還在努力中.

so far, the pTunes Widget is not finished yet. it’s still under construction.

相關閱讀 : pTunes (Preview)

 
 

淺談蘋果 Location profile, 深入用 command 切換 Location

14 Jan

在蘋果裡面網路設定很好用. 蘋果可以按照你不同地點給予不同網路環境設定profile. 例如, 在家裡撥接ADSL然後撥VPN回公司, 在辦公室用固定ip. 在會議室設定無線網路…etc 不同環境都會有不同的 profile. 甚至, 我在辦公室還有不同 profile. 例如, 上班用固定ip. 然後, 有些特殊情況要用另外一組 ip. 這時候 Location profile 就很好用.

就在 System Preferences (系統偏好) -> Network (網路) -> Location 下拉就可以編輯不同的 profile. 當你編輯好不同情境的 profile 後, 你就可以在蘋果那 選 Location.

當然用滑鼠選比較快. 但是如果要遠端執行切換 profile. 那就要靠 scselect (Select system configuration “location”) 指令來完成

例如, 我要選 Home 那就用下列指令 :

HOST:~ username$ scselect Home
CurrentSet updated to A3F0DE9C-C708-43FE-9D1D-F9230BB31C61 (Home)

如果有不懂. 歡迎留言交流. 我相信我沒有寫很仔細. :$

 
 

How to Launch GUI Applications from the Terminal?

01 Dec

如何在終端機打開圖形界面的應用程式?

一般而言, 打開應用程式要透過 Finder 進到 Applications 慢慢找某特定的應用程式. 然後點兩下執行它. 雖然, 常用的應用程式大部份都會依個人偏好放在 Dock 上方便執行. 但是, 總是會有些程式放在 Dock 上. 所以透過 Finder 尋找應用程式然後執行. 某種程度而言算是有點瑣碎. 對有些重度使用 Terminal 的使用者會認為, 如果能用某指令就能打開圖形界面的應用程式那是最好不過的. 尤其透過遠端登入要打開某個程式.那更是方便. 因為遠端沒辦法直接對某應用程式直接執行.

至於, 該怎麼遠端或是透過終端機打開圖形界面應用程式? 簡單來說就使用 open 這個指令. 先大概看一下基本的說明如下 :

$ open
Usage: open [-e] [-t] [-f] [-W] [-R] [-n] [-g] [-h] [-b ] [-a ] [filenames] [--args arguments]
Help: Open opens files from a shell.
      By default, opens each file using the default application for that file.
      If the file is in the form of a URL, the file will be opened as a URL.
Options:
      -a                Opens with the specified application.
      -b                Opens with the specified application bundle identifier.
      -e                Opens with TextEdit.
      -t                Opens with default text editor.
      -f                Reads input from standard input and opens with TextEdit.
      -R, --reveal      Selects in the Finder instead of opening.
      -W, --wait-apps   Blocks until the used applications are closed (even if they were already running).
          --args        All remaining arguments are passed in argv to the application's main() function instead of opened.
      -n, --new         Open a new instance of the application even if one is already running.
      -g, --background  Does not bring the application to the foreground.
      -h, --header      Searches header file locations for headers matching the given filenames, and opens them.

上面的內容就稍微自己看一下吧 : )

就示範幾個範例, 讓你參考.
開啓計算機

open -a Calculator

開啓 photoshop

open -a Adobe\ Photoshop\ CS4

用 Smultron 打開桌面上的 README.txt 檔案

open -a Smultron ~/Desktop/README.txt

打開某個網址

open http://liho.tw/

打開某張圖

open sexy.jpg

當然你可以把這些指令編輯道 .profile 裡面. 以方便日後開啓程式.

alias photoshop="open -a Adobe\ Photoshop\ CS4"

之後打 photoshop 就可以開啓photoshop.

遠端開啓的話, 也是一樣的方式. 只是記得在 System Preferences 開啓 Remote Login 的選項. 讓你自己能從遠端登入開啓圖形應用程式.

 
2 Comments

Posted in Macintosh

 

讓 Finder 看不見某些目錄

18 Sep

必須先安裝 Xcode. 先直接印 SetFile 指令的說明檔

# /Developer/Tools/SetFile
Usage: SetFile [option...] file...
    -a attributes     # attributes (lowercase = 0, uppercase = 1)*
    -c creator        # file creator
    -d date           # creation date (mm/dd/[yy]yy [hh:mm[:ss] [AM | PM]])*
    -m date           # modification date (mm/dd/[yy]yy [hh:mm[:ss] [AM | PM]])*
        -P                                # perform action on symlink instead of following it
    -t type           # file type

    Note: The following attributes may be used with the -a option:
        A   Alias file
        B   Bundle
        C   Custom icon*
        D   Desktop*
        E   Hidden extension*
        I   Inited*
        M   Shared (can run multiple times)
        N   No INIT resources
        L   Locked
        S   System (name locked)
        T   Stationery
        V   Invisible*
        Z   Busy*

    Note: Items marked with an asterisk (*) are allowed with folders
    Note: Period (.) represents the current date and time.
    Note: [yy]yy < 100 assumes 21st century, e.g. 20yy

假設我不想在 Finder 看到硬碟的 /opt 目錄.
我就使用下列命令即可 :

# /Developer/Tools/SetFile -a V /opt
 
 

Apple Special Event – September 2009

12 Sep

早上在床上看完 Apple Special Event – September 2009.

看到 iTune LP 這裡就覺得想笑. 可能是陳唐山曾經說過撲中國的”LP”讓我餘音繞樑久久不能忘記.

裡面的 Home Sharing 我認為比較實用. 他可以連5台電腦. 直接對別台電腦的 iTunes 音樂及影集複製到本機的 iTunes. 以往我都是手動自己整理不同台電腦的 iTunes Library. 這個功能出來後, 我覺得很實用. 其他的感覺上對我來說都沒什麼用處. 台灣一直都沒有 Music, Movies TV Store 這點讓我滿遺憾的.想要花錢買正版的數位音樂與影片都不能買.

最後的 “One more thing…”

其實也沒什麼梗. 弄個 iPod nano 可以攝影. 很不夠意思. 要不然就把 iPod Touch 也弄個能攝影. 這樣才有點誠意. 當時我以為他要講蘋果平板電腦. 沒想到講這個雞毛蒜皮. Orz

大致上, 這個 Keynote 應該是看看 Steve Jobs 還能在台上講講話.這應該就算是對 Apple 人來說滿欣慰的. 希望他能健康. 也希望他能帶給蘋果更多新產品.

 
 

第一次在蘋果Dashboard下載排行第一名

03 Sep


這是第一次被蘋果推薦


第一次在蘋果Dashboard下載排行第一名

hohoho~~開心.自己先截圖下來. 按這裡查看前 50 名

 
No Comments

Posted in Widgets

 

將蘋果電腦開機畫面改成台灣

02 Aug


台灣


我愛台灣

如果你想改變你的開機畫面. 可以使用 BootXChanger 軟體改變. 可以按這裡下載 BootXChanger 1.0.2 版本.


BootXChanger

使用方式很簡單只要將圖片拉入.按 Apply 就可以了. 這裡也有中文化. 雖然我覺得不是那麼必要.


當然你也可以像我一樣把蘋果改成台灣. :P 按這裡下載.