博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mac 释放空间_如何释放开发人员Mac上的空间
阅读量:2521 次
发布时间:2019-05-11

本文共 6603 字,大约阅读时间需要 22 分钟。

mac 释放空间

清理您肮脏的动物的开发环境! (Clean up your dev environment you filthy animal!)

I love cleaning software? PLZ! Remove duplicates, find old OS cruft etc. But it never cleans a development machine as I can.

一世 喜欢清洁软件? PLZ! 删除重复项,找到旧的OS崩溃等。但是它从来没有尽我所能清理开发机器。

Sure, for general maintenance, nothing beats . But once a year, developers should run through a few manual commands, because auto-cleaners won’t know how to take care of a developer machine.

当然,对于常规维护, 没有什么比这 。 但是,每年一次,开发人员应该执行一些手动命令,因为自动清洁器不知道如何保养开发人员的机器。

Before we start, let’s look at how much “Free Space” you’re starting with:

在开始之前,让我们先看看您有多少“可用空间”:

Mine is reporting 132.2 GB before cleaning. Time to get started!

矿山报告在清洁前为132.2 GB。 是时候开始了!

Mac Homebrew用户 (Mac Homebrew Users)

This one usually shaves off hundreds of megs of data. Update, upgrade, and then clean up those files you’re not going to use.

通常,这可以节省数百兆的数据。 更新,升级然后清理您将不使用的文件。

Update then remove old formulae and their folders:

更新然后删除旧公式及其文件夹:

brew update && brew upgrade && brew cleanup

You might have used brew prune in the past, but that has been deprecated. Cleanup handles this for you!

您过去可能曾经使用过brew prune ,但是已经过时了。 清理为您处理!

常规冲煮维护 (General Brew Maintenance)

Brew is a complicated system, and no one knows it better than the maintainers. So you can run brew doctor and get some additional chores you could take care of to have it run properly.

Brew是一个复杂的系统,没有人比维护人员更了解它。 因此,您可以运行brew doctor并获得一些其他杂务,以使其正常运行。

Git用户 (Git Users)

Git is great, but it’s not hard to leave a bunch of merged branches laying around on your local machine! Those branches aren’t useful anymore, and sometimes make naming conflicts for future branches.

Git很棒,但是在本地计算机上留下一堆合并的分支并不难! 这些分支不再有用,有时会为将来的分支命名冲突。

You can remove all the merged branches from a single project with this command:

您可以使用以下命令从单个项目中删除所有合并的分支:

git branch --merged master | grep -v "\* master" | xargs -n 1 git branch -d

WOW, what a mouthful for only one project! Let’s make it worse. ?

哇,只有一个项目真是令人a目结舌! 让我们变得更糟。 ?

This code will CD into all folders in the current working directory, and then run the command to clean merged branches for each!

此代码将CD放入当前工作目录中的所有文件夹,然后运行命令为每个清理合并的分支!

for d in */; do cd $d; echo WORKING ON $d; git branch --merged master | grep -v "\* master" | xargs -n 1 git branch -d; cd ..; done

JavaScript开发人员 (JavaScript Developers)

删除项目中嵌入的OLD`node_modules` (Delete OLD `node_modules` embedded in projects)

The following command finds all node_modules folders older than 120 days and removes them. This does mean you will have to npm i or yarn again in those older projects. This is usually a huge cleanup!

以下命令查找所有早于120天的node_modules文件夹并将其删除。 这的确意味着您将不得不在这些较早的项目中再次npm iyarn通常这是一个巨大的清理工作!

Removes all node_modules folders older than 4 months:

删除所有4个月以上的node_modules文件夹:

find . -name "node_modules" -type d -mtime +120 | xargs rm -rf

If you’re feeling quite aggressive, you can just clear out ALL node_modules folders and re-install as needed, by removing the mtime flag.

如果您感觉非常激进,则可以清除所有node_modules文件夹,然后根据需要通过删除mtime标志来重新安装。

Removes all node_modules folders:

删除所有的node_modules文件夹:

find . -name "node_modules" -type d | xargs rm -rf

删除旧版本的Node (Remove old versions of Node)

Remove old versions of Node. This varies depending on your Node manager. I use ’n’ so it’s easy for me. Consult uninstall for your specific version manager.

删除旧版本的Node。 这取决于您的节点管理器。 我使用“ n”,所以对我来说很容易。 请咨询您的特定版本管理器的卸载。

Using n?

使用n

List all versions of node + your installed ones with n ls and then remove any with n rm <version>.

n ls列出节点+已安装的所有版本,然后用n rm <versi on>删除所有版本。

Using nvm?

使用nvm吗?

List your installed versions with nvm ls and then remove any with nvm uninstall <version>.

使用nvm ls列出安装的版本,然后使用nvm uninstall <versi on>删除所有版本。

Using asdf?

使用asdf吗?

List your installed versions with asdf list nodejs and then remove any with asdf uninstall nodejs <version>.

使用asdf list nodejs列出您的已安装版本,然后使用asdf uninstall nodejs <versi on>删除所有版本。

Ruby开发人员 (Ruby Developers)

Clean up old versions of Gems with the cleanup command. If you’re worried, you can see the results first with “dryrun”.

使用cleanup命令cleanup旧版本的Gems。 如果您担心,可以先使用“ dryrun”查看结果。

gem cleanup --dryrun

Then when you are confident, you can remove the “dryrun” param and run it for real.

然后,当您有信心时,可以删除“ dryrun”参数,然后对其进行实际运行。

gem cleanup

删除旧版本的Ruby (Remove old versions of Ruby)

This depends specifically on your Ruby version manager. We’ll do two popular versions to help you out.

具体取决于您的Ruby版本管理器。 我们将提供两个受欢迎的版本来帮助您。

Using rbenv?

使用rbenv吗?

List your installed versions with rbenv versions and then remove any with rbenv uninstall <version>.

列出具有rbenv versions已安装版本,然后通过rbenv uninstall <versi on>删除所有rbenv versions

Using rvm?

使用rvm吗?

List your installed versions with rvm list and then remove any with rvm uninstall <version>.

使用rvm list列出已安装的版本,然后使用rvm uninstall <versi on>删除所有版本。

Xcode开发人员 (Xcode Developers)

Xcode loves to cache things all over your machine, and some of these are hundreds of megs. Time to clean them up, and if you need to rebuild them again, no worries!

Xcode喜欢在整个计算机上缓存内容,其中一些是数百兆。 是时候清理它们了,如果您需要再次重建它们,请不用担心!

Clean up CocoaPod caches:

清理CocoaPod缓存:

rm -rf "${HOME}/Library/Caches/CocoaPods"

Delete old Xcode Simulators:

删除旧的Xcode模拟器:

xcrun simctl delete unavailable

Clean up various archives, logs, and derived data folders:

清理各种档案,日志和派生数据文件夹:

rm -rf ~/Library/Developer/Xcode/Archivesrm -rf ~/Library/Developer/Xcode/DerivedDatarm -rf ~~/Library/Developer/Xcode/iOS Device Logs/

Check out your connected device info in ~/Library/Developer/Xcode/iOS Device Logs/ and delete anything for old iOS devices you’ve connected.

~/Library/Developer/Xcode/iOS Device Logs/查看您已连接的设备信息,并删除已连接的旧iOS设备的所有内容。

码头工人 (Docker)

You can remove all volumes not used by at least one container. Because… why would you want those?!

您可以删除至少一个容器未使用的所有卷。 因为……你为什么想要那些?

This might be huge or it might remove nothing. Worth a run right!?

这可能很大,也可能什么也没有清除。 值得一游吧!?

Remove unused local volumes

删除未使用的本地卷

docker volume prune

结果?! (RESULTS?!)

Don’t forget to empty your trash and check on how we did!

不要忘记清空您的垃圾并检查我们的工作方式!

30 GIGS! pulled off my machine! How about you?
30 GGGS! 拿走我的机器! 你呢?

Your success is probably vastly different, but I’d love to know. Comment or your results, and any other developer spots you recommend we clean! I’ll be happy to add your advice to the article.

您的成功可能有很大的不同,但我很想知道。 的结果发表评论或 ,以及我们建议您清除的其他开发人员建议! 我很乐意将您的建议添加到文章中。



is Chief Technology Strategist at , published author, adjunct professor, worldwide public speaker, and a mad scientist in training. Clap/follow/ or visit him .

( 是首席技术策略师,已发表的作者,兼职教授,全球演讲者和训练中的疯狂科学家。 拍手/跟随/ 或拜访他。

翻译自:

mac 释放空间

转载地址:http://kfwzd.baihongyu.com/

你可能感兴趣的文章
图片放大器——wpf
查看>>
SCALA STEP BY STEP
查看>>
cocos2d-x学习笔记
查看>>
MySql中的变量定义
查看>>
Ruby数组的操作
查看>>
hdu1181暴搜
查看>>
解码字符串 Decode String
查看>>
json学习笔记
查看>>
工具:linux 性能监控工具-nmon
查看>>
fatal error C1853
查看>>
Ural 1001 - Reverse Root
查看>>
玩转webpack之webpack的entry output
查看>>
java 操作mongodb查询条件的常用设置
查看>>
黑马程序员_java基础笔记(02)...java语言基础组成
查看>>
关于缓存击穿
查看>>
对innodb 拷贝文件实现数据库的方式(转)
查看>>
python知识点 2014-07-09
查看>>
FloatingActionButton的一点学习感悟
查看>>
ABAP CDS ON HANA-(10)項目結合して一つ項目として表示
查看>>
网站地址信息
查看>>