~/library/LaunchAgents/local.arch.plist
:
<?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>Label</key>
<string>local.arch</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/arch</string>
<string>-i386</string>
<string>/usr/bin/python2.7</string>
<string>/volumes/ramdisk/arch.py</string>
</array>
<key>RunAtLoad</key>
<false/>
</dict>
</plist>
/volumes/ramdisk/arch.py
:
import sys
with open('/volumes/ramdisk/python.arch.log', 'a') as f:
f.write('sys.maxsize = %s\n' % sys.maxsize)
在终端:
$ launchctl load ~/library/LaunchAgents/local.arch.plist
$ launchctl start local.arch
$ # arch -i386, 32-bit
$ cat /volumes/ramdisk/python.arch.log
sys.maxsize = 2147483647
$ # no arch, 64-bit
$ /usr/bin/python2.7 -c 'import sys; print(sys.maxsize)'
9223372036854775807