WindowsmacOSLinux

Where Is the PowerShell Profile Script?

PowerShell $PROFILE paths for PowerShell 7 versus Windows PowerShell 5.1 on Windows, macOS and Linux.

Last updated

PowerShell loads a profile script from your Documents folder at startup. PowerShell 7 uses a PowerShell folder; legacy Windows PowerShell 5.1 uses WindowsPowerShell. Both can exist side by side.

Never guess the path. Run the profile variable in a shell and it prints the exact file for that host and user.

Where PowerShell stores this, by platform

Windows
%USERPROFILE%\Documents\PowerShell\Microsoft.PowerShell_profile.ps1

PowerShell 7 path. Windows PowerShell 5.1 uses Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 instead. Create the file if missing; it does not exist by default.

macOS
~/.config/powershell/Microsoft.PowerShell_profile.ps1

PowerShell 7 only (5.1 is Windows only). Print the live path from inside pwsh before editing.

Linux
~/.config/powershell/Microsoft.PowerShell_profile.ps1

Same as Mac. VS Code hosts use their own profile variant, so check which host you customize.

Frequently asked questions

How do I print my real profile path?

Echo the automatic profile variable in the shell. It resolves per user, per host, with no guessing.

Why does my profile load in the console but not in VS Code?

VS Code uses a separate host profile (Microsoft.VSCode_profile.ps1). Put shared setup in the common profile both hosts read.

Notice an outdated path? Let us know.