mac 下常用命令(xcode常用命令,环境相关等)


1. 统计代码行数:CD到项目目录下
列出每个文件的行数 find . -name "*.m" -or -name "*.mm" -or -name "*.h" -or -name "*.xib" -or -name "*.c" |xargs wc -l
列出代码行数总和 find . -name "*.m" -or -name "*.mm" -or -name "*.h" -or -name "*.xib" -or -name "*.c" |xargs grep -v "^$"|wc -l

2. 显示隐藏文件
defaults write com.apple.finder AppleShowAllFiles Yes && killall Finder 显示隐藏文件

3. Xcode 模板路径
/Applications/xcode6.3/Xcode6.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates

4. svn ls xxxx (xxx是你SVN Server的地址)

5. MAC下JAVA的安装路径
/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home

6. 如何看一个可执行文件是不是支持64-bit呢?
使用lipo -info命令,比如看看UIKit支持的架构:
// 当前在Xcode Frameworks目录
sunnyxx$ lipo -info UIKit.framework/UIKit
Architectures in the fat file: UIKit.framework/UIKit are: arm64 armv7s
想看的更详细的信息可以使用: lipo -detailed_info
sunnyxx$ lipo -detailed_info UIKit.framework/UIKit
Fat header in: UIKit.framework/UIKit
fat_magic 0xcafebabe
nfat_arch 2
architecture arm64
cputype CPU_TYPE_ARM64
cpusubtype CPU_SUBTYPE_ARM64_ALL
offset 4096
size 16822272
align 2^12 (4096)
architecture armv7s
cputype CPU_TYPE_ARM
cpusubtype CPU_SUBTYPE_ARM_V7S
offset 16826368
size 14499840
align 2^12 (4096)
当然,还可以使用file命令:
sunnyxx$ file UIKit.framework/UIKit
UIKit.framework/UIKit: Mach-O universal binary with 2 architectures
UIKit.framework/UIKit (for architecture arm64):Mach-O 64-bit dynamically linked shared library
UIKit.framework/UIKit (for architecture armv7s):Mach-O dynamically linked shared library arm

stat -x 文件名

7. 合并多个架构的包:
如果,我们有MyLib-32.a和MyLib-64.a,可以使用lipo -create命令合并:
sunnyxx$ lipo -create MyLib-32.a MyLib-64.a -output MyLib.a

原文地址:https://www.cnblogs.com/water-wjf/p/12941145.html