PC

Macにnkfをインストール(MacPorts)

@rabirgoです。

MacPortsでnkfをインストールした際のメモ、というかログ。nkfは文字コードや改行コードを変換してくれるコマンドです。

Linuxコマンド集 – 【 nkf 】 文字コードを変換する:ITpro


[bash]
$ sudo port -d selfupdate
Password:
DEBUG: Copying /Users/username/Library/Preferences/com.apple.dt.Xcode.plist to /opt/local/var/macports/home/Library/Preferences
DEBUG: MacPorts sources location: /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
—> Updating MacPorts base sources using rsync
receiving file list … done
base.tar

sent 11482 bytes received 353937 bytes 38465.16 bytes/sec
total size is 4915200 speedup is 13.45
receiving file list … done
base.tar.rmd160

sent 64 bytes received 635 bytes 127.09 bytes/sec
total size is 512 speedup is 0.73
DEBUG: successful verification with key /opt/local/share/macports/macports-pubkey.pem
DEBUG: /usr/bin/tar -C /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/tmp -xf /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/base.tar
MacPorts base version 2.1.3 installed,
DEBUG: Rebuilding and reinstalling MacPorts if needed
MacPorts base version 2.1.3 downloaded.
—> Updating the ports tree
Synchronizing local ports tree from rsync://rsync.macports.org/release/tarballs/ports.tar
DEBUG: /usr/bin/rsync -rtzv –delete-after rsync://rsync.macports.org/release/tarballs/ports.tar /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
receiving file list … done
ports.tar

sent 51074 bytes received 7363219 bytes 178657.66 bytes/sec
total size is 53350400 speedup is 7.20
DEBUG: /usr/bin/rsync -rtzv –delete-after rsync://rsync.macports.org/release/tarballs/ports.tar.rmd160 /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
receiving file list … done
ports.tar.rmd160

sent 64 bytes received 636 bytes 155.56 bytes/sec
total size is 512 speedup is 0.73
DEBUG: successful verification with key /opt/local/share/macports/macports-pubkey.pem
DEBUG: /usr/bin/tar -C /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/tmp -xf /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports.tar
DEBUG: /usr/bin/rsync -rtzv –delete-after rsync://rsync.macports.org/release/tarballs/PortIndex_darwin_12_i386/PortIndex /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
receiving file list … done
PortIndex

sent 18634 bytes received 790991 bytes 77107.14 bytes/sec
total size is 9794829 speedup is 12.10
DEBUG: /usr/bin/rsync -rtzv –delete-after rsync://rsync.macports.org/release/tarballs/PortIndex_darwin_12_i386/PortIndex.rmd160 /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
receiving file list … done
PortIndex.rmd160

sent 64 bytes received 636 bytes 155.56 bytes/sec
total size is 512 speedup is 0.73
DEBUG: successful verification with key /opt/local/share/macports/macports-pubkey.pem
—> MacPorts base is already the latest version
DEBUG: Setting MacPorts sources ownership to root

The ports tree has been updated. To upgrade your installed ports, you should run
port upgrade outdated
$ sudo port -d sync
DEBUG: Copying /Users/username/Library/Preferences/com.apple.dt.Xcode.plist to /opt/local/var/macports/home/Library/Preferences
—> Updating the ports tree
Synchronizing local ports tree from rsync://rsync.macports.org/release/tarballs/ports.tar
DEBUG: /usr/bin/rsync -rtzv –delete-after rsync://rsync.macports.org/release/tarballs/ports.tar /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
receiving file list … done

sent 36 bytes received 70 bytes 23.56 bytes/sec
total size is 53350400 speedup is 503305.66
DEBUG: /usr/bin/rsync -rtzv –delete-after rsync://rsync.macports.org/release/tarballs/ports.tar.rmd160 /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
receiving file list … done

sent 36 bytes received 77 bytes 25.11 bytes/sec
total size is 512 speedup is 4.53
DEBUG: successful verification with key /opt/local/share/macports/macports-pubkey.pem
DEBUG: /usr/bin/tar -C /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/tmp -xf /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports.tar
Creating port index in /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports

Total number of ports parsed: 0
Ports successfully parsed: 0
Ports failed: 0
Up-to-date ports skipped: 17379

$ port search nkf
nkf @2.1.3 (textproc, japanese)
Network Kanji code conversion Filter

p5-nkf @2.120.0 (perl, textproc, japanese)
A perl extension module to use nkf.

p5.8-nkf @2.120.0 (perl, textproc, japanese)
A perl extension module to use nkf.

p5.10-nkf @2.120.0 (perl, textproc, japanese)
A perl extension module to use nkf.

p5.12-nkf @2.120.0 (perl, textproc, japanese)
A perl extension module to use nkf.

p5.14-nkf @2.120.0 (perl, textproc, japanese)
A perl extension module to use nkf.

p5.16-nkf @2.120.0 (perl, textproc, japanese)
A perl extension module to use nkf.

Found 7 ports.
$ sudo port install nkf
—> Fetching archive for nkf
—> Attempting to fetch nkf-2.1.3_2.darwin_12.x86_64.tbz2 from http://lil.fr.packages.macports.org/nkf
—> Attempting to fetch nkf-2.1.3_2.darwin_12.x86_64.tbz2.rmd160 from http://lil.fr.packages.macports.org/nkf
—> Installing nkf @2.1.3_2
—> Activating nkf @2.1.3_2
—> Cleaning nkf
—> Updating database of binaries: 100.0%
—> Scanning binaries for linking errors: 100.0%
—> No broken files found.
UTF-8
$ nkf -Ew -Lu *.c | nkf -g
UTF-8
$ nkf -Ew -Lu –overwrite *.c

[/bash]

主な使い方は、まとめてくれている方が居るので参照されるといいでしょう。GUIベースのツールもたまに見かける気がしますが、コマンドの方が楽です。

文字コード変換コマンドの nkfの使い方と実例をまとめました。 – それマグで!

いじょ。

ABOUT ME
rabirgo
うさぎ年(rabbit)おとめ座(virgo)生まれの rabirgo です。 2019年よりフリーランスとして活動しています。 よかったら Twitter フォローお願いします! Follow @rabirgo

COMMENT

メールアドレスが公開されることはありません。 が付いている欄は必須項目です