Linux нет команды make

Не найдена команда make в Linux

Утилита 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 в этих каталогах:

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

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

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

Затем проверьте, что путь к директории с файлом make указан в переменной окружения 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 новую директорию, используйте команду:

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

export PATH=$PATH:/path_to/dir

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

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

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

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

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

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

или

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

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

В deb-based дистрибутивах, таких Ubuntu, Debian, Raspbian, Kali Linux можно установить пакет 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:

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

RUN apt-get install -y build-essential

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

Читайте также:  Conky для linux mint

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:

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

Источник

How to Fix “Make: Command Not Found” Error

make-command-not-found

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.

How to Fix Make Command Not Found

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:

sudo-apt-get-update

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

Next, you can install make with the following commands:

sudo-apt-get-install-make

  • On Debian-based distros:
    sudo apt-get install -y 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.

sudo-apt-install-build-essential

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

export-path-linux-make

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

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:

install-chocolatey-powershell

  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’))
  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:\ProgramData\chocolatey ) should be present there.
    path

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

xport-xcode

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

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.

Anup Thapa primarily covers Windows systems, networking, and computer hardware at TechNewsToday. Anup has been writing professionally for almost 5 years, and tinkering with PCs for much longer. His love for all things tech started when he got his first PC over 15 years ago. It was a Pentium IV system running Windows XP on a single 256 MB stick. He spent his formative years glued to this PC, troubleshooting any hardware or software problems he encountered by himself. Professionally, Anup has had brief forays into a variety of fields from coding and hardware installation to writing. In doing so, he’s worked with people of different backgrounds and skill levels, from average joes to industry leaders and experts. This has given him not just a versatile skill set, but also a unique perspective for writing that enables him to concisely communicate complex information and solve his reader’s problems efficiently. You can reach out to him at anup@technewstoday.com.

Источник

How to fix “make: command not found” error

“make”, or GNU make, is a program which is used to compile other programs or libraries from source code. Make is frequently preinstalled with the operating system or bundled in a package set such as build-essential on Linux. On MacOS, it comes with the Xcode command line tools set. On Windows, make is not installed by default.

‘make’ is currently not installed or make: command not found are common error messages, which often pop up in the middle of a program installation. The full error message should look like below.

The program 'make' is currently not installed. You can install it by typing: sudo apt install makeCode language: JavaScript (javascript)
Command 'make' not found, but can be installed with: OR bash: /usr/bin/make: No such file or directoryCode language: JavaScript (javascript)

In this short article, we will show you a few ways to fix “make: command not found” error.

Install make

One of the common reasons causing “make: command not found” error is you haven’t got make installed on the system. In order to install make , sequentially run the following commands.

sudo apt update sudo apt install make

The first command is used to refresh the local package cache, while the second actually install make . Updating the package cache is very important, doing so would let the system be aware of the security updates and latest bug fixes before installing make .

Once the installation is done, you can verify that make has been properly installed by running the following command

Better alternative: Install build-essential

However, another option, and most likely the solution you seek, is to install the entire development package named build-essential .

build-essential is a metapackage (a package that installs many other packages) which includes all the packages needed to compile a Debian package (including make )

build-essential generally includes the GNU C & C++ compilers and some other utilities for compiling packages from source.

In order to install build-essential , run the following command.

sudo apt install build-essential

Ensure make is in PATH

If you’re sure that make is installed, the next thing in the checklist would be to ensure the path to make executable is present in PATH environment variable.

  • First, check whether make executable is present by running which make . You should get back the location of its executable.
  • After that, run make using the full path to be really sure that it works properly. In this example, run /usr/bin/make —version .
  • Now print out the PATH environment variable and inspect it to ensure the path to make executable is present. Run echo $PATH to print out PATH environment variable. . PATH environment variable consists of paths separated by a colon.

Command not found error messages are common in Linux, it usually indicates the missing of executables in the system. If you’re encountering a “command not found” error message, you may want to check out our other guide like fix zsh: command not found, adb: command not found and apt-get: command not found. If you have any suggestions or spot an error in the article, feel free to leave a comment below to let us know.

Источник

Оцените статью
Adblock
detector