Make not found как исправить

I am having a problem that doesn’t seem to be common based on searching various forums.

I cannot run the Make command.

Message:

The program 'make' is currently not installed. You can install it by typing:
sudo apt-get install make

So do this:

sudo apt-get install make
Reading package lists... Done
Building dependency tree       
Reading state information... Done
make is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

But then when I try to run Make I get the same message. What’s up?

Edit: Ubuntu 12.04 64bit Desktop fresh install.

shgnInc's user avatar

shgnInc

3,5834 gold badges26 silver badges29 bronze badges

asked Sep 25, 2012 at 0:39

snoopdogg's user avatar

0

Run this command to install make and all the packages needed to build your code.

sudo apt-get install build-essential

answered Apr 2, 2016 at 17:59

JorelC's user avatar

JorelCJorelC

1,7731 gold badge9 silver badges7 bronze badges

2

Probably it is due command make is not present in system PATH, so remove and reinstall it.

sudo apt-get install --reinstall make

answered Sep 25, 2012 at 1:25

Tachyons's user avatar

TachyonsTachyons

17.2k18 gold badges74 silver badges116 bronze badges

0

Run command:

sudo apt-get update

to update package lists. After this,

sudo apt-get install make

d a i s y's user avatar

d a i s y

5,3919 gold badges40 silver badges59 bronze badges

answered Feb 27, 2017 at 10:17

user659415's user avatar

user659415user659415

1211 silver badge2 bronze badges

First you should update your packages and then install «make».

sudo apt-get update
sudo apt-get install make

answered Mar 6, 2022 at 4:10

Omega's user avatar

OmegaOmega

112 bronze badges

I was coming from a background of installing WSL2 just today and was surprised to find that packages like make weren’t already there, as I was so used to them being.

Then I realized my Ubuntu is a bit of a «clean slate». So I decided to update it to get essential development packages as per ‘standard’ recommendation, I guess:

sudo apt-get update

sudo apt-get upgrade

sudo apt-get dist-upgrade

sudo apt-get autoremove

Source: https://www.sitepoint.com/wsl2/

Edit: Install pip, too!

answered Jul 25, 2021 at 1:50

ItDepends's user avatar

Run

sudo apt-get install build-essential

Before running make, you might also need to generate a Makefile first.

Run

./configure

Then the make command

answered Jan 8, 2022 at 21:18

Tabraiz Malik's user avatar

I had the same problem.
Initially I had setup Eclipse CDT with Cygwing & was working smoothly. One day there happened a problem due to which I had to reset windows. After that when I opened Eclipse I started facing the issue described above. This is how I solved it.

First I searched that in the error the PATH variable value is same as the PATH variable of windows ( just by manual comparison of both two values ). I found that to be same. Now I realized that it is a PATH problem.

Then started looking for Cygwin whether it is there or not? It was there. I located & found that it exists in

C:cygwin64bin>
C:cygwin64bin>dir ma*
 Volume in drive C is Windows8_OS
 Volume Serial Number is 042E-11B5

 Directory of C:cygwin64bin

16-05-2015  18:34            10,259 mag.exe
13-08-2013  04:57               384 mailmail
11-04-2015  02:56             4,252 make-emacs-shortcut
15-02-2015  23:25           194,579 make.exe
04-05-2015  21:36            40,979 makeconv.exe
29-07-2013  11:57            29,203 makedepend.exe
16-05-2015  18:34            79,891 makeindex.exe
16-05-2015  18:34            34,323 makejvf.exe
07-05-2015  03:04               310 mako-render
18-04-2015  02:07            92,179 man.exe
18-04-2015  02:07           113,683 mandb.exe
13-08-2013  04:57               286 manhole
18-04-2015  02:07            29,203 manpath.exe
24-10-2014  13:31           274,461 mate-terminal.exe
24-10-2014  13:31             1,366 mate-terminal.wrapper
              15 File(s)        905,358 bytes
               0 Dir(s)  373,012,271,104 bytes free

C:cygwin64bin>

Then I simply went ahead & updated the PATH variable to include this path & restarted eclipse.

The code compiles & debugging (GDB ) is working nicely.

Hope this helps.

Утилита make в Linux используется для сборки и компиляции программ из исходных файлов. Инструкции о компиляции утилита берет из файла makefile. В некоторых дистрибутивах Linux утилита make не установлена по умолчанию (например, в Linux CentOS 8), поэтому при запуске команды сборки, вы увидеть ошибку:

bash: make: command not found

make: command not found

Или

bash: /usr/bin/make: No such file or directory

В консоли Ubuntu появляется уведомление:

The program 'make' is currently not installed. You can install it by typing:
sudo apt install make

Проверьте, что команда make установлена и путь к ней есть в PATH

В первую очередь проверьте, что команда make установлена в вашем дистрибутиве Linux и путь к ее директории указан в переменной окружения PATH.В большинстве случае файл make должен находится в директории /usr/bin или /usr/local/bin. Проверьте, есть ли исполняемый бинарный файл make в этих каталогах:

$ ls /usr/bin/make

Если вы нашли исполняемый файл make в этой директории, проверьте что вы можете запустить его с абсолютным путем:

$ /usr/bin/make –version

GNU Make 3.82
Built for x86_64-redhat-linux-gnu
Copyright (C) 2010  Free Software Foundation, Inc.

команда make /usr/bin в linux

Затем проверьте, что путь к директории с файлом make указан в переменной окружения PATH:

$ which make
$ echo "$PATH"

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

пути в переменной окружения path

В нашем примере путь /usr/bin содержится в переменной окружения PATH. Чтобы добавить в PATH новую директорию, используйте команду:

export PATH=$PATH:/path_to/dir

Чтобы сделать это изменение постоянным для текущего пользователя, отредактируйте файл ~/.bashrc:

$ nano ~/.bashrc

Добавьте в конец строку:

export PATH=$PATH:/path_to/dir

Как установить команду make в различных ОС?

Если утилита действительно отсутствует на вашем компьютере, ниже мы покажем установить команду make в разных версиях Linux.

В Fedora, Oracle/Rocky Linux, CentOS, Fedora и RHEL утилита make можно установить отдельно с помощью команды:

# yum install make

или

# dnf install make

установка команды make в Linux

Или в составе группы пакетов Development tools (потребуется около 500 Мб на диске).

# dnf groupinstall "Development tools" (в RHEL/CentOS 8)

или

# yum groupinstall "Development tools"
(в предыдущих версиях RPM дистрибутивов Linux)

Если make уже установлен, но не работает, можете переустановить его:

# yum reinstall make

В deb-based дистрибутивах, таких Ubuntu, Debian, Raspbian, Kali Linux можно установить пакет make с помощью команд:

#apt-get install make

Также команда make содержится в метапакете build-essential. Для его установки выполните:

# apt-get install build-essential

Для переустановки пакета make, выполните:

# apt-get install --reinstall make

Или

# sudo dpkg-reconfigure make

Или:

# apt-get remove make
# apt-get install make

В дистрибутивах на основе Arch (Arch Linux, Manjaro) утилиту make можно установить отдельно:

$ sudo pacman –Syu
$ sudo pacman -S make

Или вместе с пакетом base-devel:

$sudo pacman -Sy base-devel

Для автоматической установки команды make и средств разработки в Docker контейнере можно добавить в docker файл инструкцию:

RUN apt-get install -y build-essential

В Windows можно установить команду make с помощью менеджера пакета Chocolatey. Установите choco (если не установлен):

PS> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Затем можете установить make в Windows:

PS>  choco install make

Для сборки из исходников также используется команда CMake. Если она не установлена, появится ошибка cmake command not found.

Want to build a package but stuck with the «make: command not found» error in Ubuntu? Here’s how you can get rid of the error for good.

Person using a command on a computer

The make command is probably one of the most widely used commands in the Linux ecosystem. This command builds and compiles programs directly from the source code.

As a Linux user, you can use the make command to compile and install utilities from the terminal. But sometimes, the system throws the «make: command not found» error when users try to build a package using make.

By the end, you will understand how to fix the «make command not found» error on Ubuntu.

Fix the «make: command not found» Error

While make is one of the standard Linux packages and comes pre-installed on most Linux distros, sometimes it isn’t available on a system. In such cases, the system throws the make not found error whenever you try to build a package using make.

You need to follow a few steps to ensure the make command is correctly installed and works on your computer:

1. Verify if make Is Installed on Ubuntu

The primary step is verifying whether make exists on your machine. Use the ls command to check the contents of the /usr/bin/make directory:

 ls /usr/bin/make 

Further on, check if you can execute the command with its absolute path:

 /usr/bin/make --version 

The aforementioned command will display the make version installed on your system. Ubuntu will display the make command not found error if it’s not installed on your machine.

Linux Ubuntu terminal interface showing verification commands

2. Installing make With APT

To fix the make command not found error, you should start by updating your system with this one-liner:

 sudo apt update && sudo apt upgrade -y 

Linux Ubuntu terminal interface showing update commands

Post system update, install the make command by running:

 sudo apt install -y make 

Output:

Linux Ubuntu terminal interface with installation commands

If the aforementioned command doesn’t work, download and install the build-essential package, as follows:

 sudo apt install build-essential 

Output:

Linux Ubuntu terminal interface showing installation commands

build-essential consists of all the necessary packages required for building and compiling Linux packages from the source. The make command is a part of these packages.

What to Do if make Still Doesn’t Work?

If you followed the above steps and the make command is still not working, you can try one last step. Sometimes, the make command doesn’t get added to the $PATH variable. To fix this issue, reinstall make with the —reinstall command.

 sudo apt install --reinstall make 

If this still does not work, you must manually add the binary to your $PATH as a last step. In all entirety, the above steps should work and you should get past this «command not found» error with ease.

Troubleshooting Command Errors on Ubuntu

The make command is an essential compiler tool on Linux. The errors provided by the system are usually self-descriptive, and experienced users can figure out the solution by looking at the error statement.

In addition to local workstations, Linux-based servers also throw such errors. You can fix most issues by performing a basic audit on the server.

The Make Command Not Found error indicates that the make utility is either not installed on the system or it’s not present in the PATH variable. 

On Linux, make is often preinstalled or included with package sets like build-essential. On Mac, it’s included with the Xcode command line tools, whereas on Windows, you must manually install it.

Of course, there are ways to manually install make on Linux and Mac as well. We’ve discussed these and other fixes in further detail in the sections below.

As stated, you should ensure make is actually installed and present in the PATH variable. Additionally, as this issue is common with codespace, we’ve also listed a relevant fix for that.

On Linux

Depending on the Linux system, the make command may or may not be installed. If it’s installed, you should check the PATH variable. But often, it’s just not installed to start with. Do note that before you install make, you may have to update the package list first. Here’s how you can do this on various distros:

  • On Debian-based distros:
    sudo apt-get update
    sudo-apt-get-update
  • On Arch-based distros:
    sudo pacman -Syu

Next, you can install make with the following commands:

  • On Debian-based distros:
    sudo apt-get install -y make
    sudo-apt-get-install-make
  • On RPM distros:
    sudo yum install make
  • On Arch-based distros:
    sudo pacman -S make

If installing make like this doesn’t work, you can install it as part of the build-essential or similar set of packages.

  • On Debian-based distros:
    sudo apt install -y build-essential
    sudo-apt-install-build-essential
  • On RPM Distros:
    sudo yum groupinstall "Development Tools"
  • On Arch-based distros:
    sudo pacman -Sy base-devel

Make is generally located in the /usr/bin or /usr/local/bin directory. These directories should already be in your PATH variable, but if not, you can add them as such:
export PATH=$PATH:/file/path
export-path-linux-make

On Windows

Unlike Linux, make isn’t installed by default on Windows. We recommend using chocolatey to install it. Here are the steps for this:

  1. Press Win + R, type powershell, and press Enter.
  2. Execute the following command to install choco:
    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
    install-chocolatey-powershell
  3. After installing it, restart the PowerShell window and enter choco install make to install make.

If installing make doesn’t resolve the error, you should check the PATH variable. Here’s how you can do this:

  1. Press Win + R, type systempropertiesadvanced, and press Enter.
  2. Click on Environment Variables.
    environment-variables-sys-properties
  3. Check the System Variables section. If you installed make with choco, the ChocolateyInstall variable (C:ProgramDatachocolatey) should be present there.
    path
  4. If you used another method like MinGW, you should press New and add the appropriate path (e.g., C:MinGWbin). Additionally, try calling make differently (e.g., MinGW32-make).

On Mac

On fresh Mac installations, you must first install the Xcode command line tools in order to use make. You can download the complete Xcode files from the developer site, or you can download Xcode from the App Store. 

With older Xcode versions, command line tools like make were bundled by default. But now, you must manually them by going to Xcode > Preferences > Downloads > Components > Install Command Line Tools.

For even newer versions, we recommend just running the xcode-select --install command in the terminal, as this will specifically install the command line tools instead of all the Xcode files.

xcode-install

Note: If you have homebrew installed, you can easily install make with sudo brew install make.

If make still doesn’t work, you should check the PATH variable. For older Xcode versions, you can add /Developer/usr/bin to the PATH environment variable with:
$ export PATH=$PATH:/Developer/usr/bin

For recent Xcode versions, you can instead use the following command:
export PATH=$PATH:/Applications/Xcode.app/Contents/Developer/usr/bin
xport-xcode

Rebuild Codespace

If you’re facing this error while trying to compile anything from GitHub, the codespace might be the problem. You may be able to resolve this error by deleting the codespace and reinstalling it. You can do this from your GitHub Codespaces page.

Понравилась статья? Поделить с друзьями:
  • Как найти работу помощника руководителя
  • Как найти клиентов сша
  • Как составить аннотацию к тексту 4 класс
  • Как найти частицу в ядерной реакции
  • Ребенок пишет зеркально как это исправить