# bash: nvcc: command not found — CUDA toolkit not installed or not on PATH

**Code:** `nvcc: command not found` · **Category:** C/C++ · **Seen on:** C/C++, CUDA, Linux

The shell cannot find the CUDA compiler.

## Meaning

`nvidia-smi` only shows the driver; `nvcc` comes from the CUDA Toolkit, which installs under `/usr/local/cuda-XX/bin` and needs to be added to PATH.

## Common causes

- CUDA Toolkit not installed (driver only)
- PATH missing `/usr/local/cuda/bin`
- Installed in a container without the devel image
- Wrong shell profile edited

## Quick fix

1. Install the toolkit (not just the driver)
2. Add `export PATH=/usr/local/cuda/bin:$PATH`
3. Use an `nvidia/cuda:*-devel` Docker image

## Detailed fix by platform

### Linux

1. `export PATH=/usr/local/cuda/bin:$PATH; export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH`

## How to diagnose

1. **Toolkit** — Installed?
2. **PATH** — Contains cuda/bin?
3. **Image** — devel not runtime?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cpp/cuda-nvcc-command-not-found)
