OS X终端颜色 [英] OS X Terminal Colors

查看:125
本文介绍了OS X终端颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是OS X的新手,在使用Ubuntu Linux一段时间后刚获得一台Mac.我要弄清楚的许多事情是终端窗口中没有颜色-如运行ls -lagit status ...

I'm new to OS X, having just gotten a Mac after working with Ubuntu Linux for some time. Among the many things I'm trying to figure out is the absence of colors in my terminal window - like the ones that are shown (on Linux) when running ls -la or git status...

我只是不知道如何激活外壳中的颜色.

I just can't figure out how to activate colors in my shell.

推荐答案

这是我发现的启用全局 终端颜色.

Here is a solution I've found to enable the global terminal colors.

在主目录中编辑.bash_profile(自OS X 10.8起)-或(对于10.7及更低版本):.profile.bashrc/etc/profile(取决于可用性)并添加以下代码:

Edit your .bash_profile (since OS X 10.8) — or (for 10.7 and earlier): .profile or .bashrc or /etc/profile (depending on availability) — in your home directory and add following code:

export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced

CLICOLOR=1只需启用终端的着色即可.

CLICOLOR=1 simply enables coloring of your terminal.

LSCOLORS=...指定如何给特定项目上色.

LSCOLORS=... specifies how to color specific items.

编辑.bash_profile后,启动终端并通过执行以下命令来强制进行更改:

After editing .bash_profile, start a Terminal and force the changes to take place by executing:

source ~/.bash_profile

然后转到Terminal > Preferences,单击Profiles选项卡,然后单击Text子选项卡并选中Display ANSI Colors.

Then go to Terminal > Preferences, click on the Profiles tab and then the Text subtab and check Display ANSI Colors.

在Sierra上验证(2017年5月).

这篇关于OS X终端颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆