Skip to content

I hate key input

HG_Ko edited this page May 10, 2023 · 9 revisions

How to declare environment variables

Windows 10 ~

To persist environment variables and keep them assigned even after a computer reboot, follow these steps in PowerShell:

  1. Run PowerShell as an administrator.
  2. Enter the following command to set the variable as a user environment variable:
[Environment]::SetEnvironmentVariable("TENOR_API_KEY", "Insert your Tenor Key", "User")

Executing the above command will set the "TENOR_API_KEY" environment variable as a user environment variable, ensuring its persistence. Now, even if you reboot the computer, the "TENOR_API_KEY" environment variable will remain intact.

Mac os

macOS to set environment variables and ensure persistence even after reboot is by using the launchctl setenv command in the Terminal. Here is the command for this approach:

launchctl setenv TENOR_API_KEY "<YOUR_API_KEY>"

Execute the command above, replacing <YOUR_API_KEY> with your actual API key. Now, the environment variable "TENOR_API_KEY" will be set, and it will remain intact even after reboot.

This method offers a quick and straightforward way to set environment variables via the Terminal and ensure their persistence.

Clone this wiki locally