---
title: "mac   ifconfig: command not found"
author: "songzhan"
date: "2014-06-05T17:23:54Z"
tags: []
categories: ["操作系统"]
slug: "mac-ifconfig-command-not-found"
draft: false
lastmod: "2014-06-05T17:23:54Z"
id: 2076371
url: "https://songzhan.iteye.com/blog/2076371"
---

mac 系统升级 到10.9.3 时，发现   ifconfig   不能用了。

上网找资料看了下，才明白，原来是  ifconfig命令所在路径/sbin未包含在系统环境变量PATH中

解决方法：  
1\. 直接在终端输入命令：/sbin/ifconfig  
2\. 临时修改环境变量：在shell中输入  
   $export PATH = "$PATH":/sbin  
   然后再输入ifconfig命令即可，但是这只是暂时的更改了shell中的PATH，如果关闭shell，则修改消失，下次还需要重复如上操作  
3.永久修改PATH变量使之包含/sbin路径：  
   打开/etc/profile文件，在其中输入export PATH=$PATH:/sbin，保存

然后在终端继续执行该命令   source  profile    （注：profile 是你修改的文件名）  该命令是让修改的内容，立刻生效，而不用再重启系统了