# run-applescript

> Run AppleScript and get the result

Latest version **7.1.0** (published 2025-09-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install run-applescript
pnpm add run-applescript
yarn add run-applescript
bun add run-applescript
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 7.1.0 |
| Published | 2025-09-09 |
| First published | 2014-08-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=18 |
| Dependencies | 0 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 171 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | macos, mac, applescript, osascript, run, execute |

## Links

- npm: https://www.npmjs.com/package/run-applescript
- Repository: https://github.com/sindresorhus/run-applescript
- Homepage: https://github.com/sindresorhus/run-applescript#readme
- Issues: https://github.com/sindresorhus/run-applescript/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/run-applescript

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 7.1.0 (latest) — 2025-09-09
- 7.0.0 — 2023-12-18
- 6.1.0 — 2022-12-12
- 6.0.0 — 2021-08-12
- 5.0.0 — 2021-03-07
- 4.0.0 — 2019-10-28
- 3.2.0 — 2018-07-20
- 3.1.0 — 2017-12-25
- 3.0.0 — 2016-04-26
- 2.1.0 — 2015-11-14
- 2.0.0 — 2015-10-05
- 1.0.1 — 2014-08-18
- 1.0.0 — 2014-08-18

## README

# run-applescript

> Run AppleScript and get the result

## Install

```sh
npm install run-applescript
```

## Usage

```js
import {runAppleScript} from 'run-applescript';

const result = await runAppleScript('return "unicorn"');

console.log(result);
//=> 'unicorn'
```

## API

### runAppleScript(script, options?)

Returns a `Promise<string>` with the script result.

#### script

Type: `string`

The script to run.

#### options

Type: `object`

##### humanReadableOutput

Type: `boolean`\
Default: `true`

Change the output style.

When `false`, returns the value in a [recompilable source form](https://ss64.com/osx/osascript.html).

##### signal

Type: `AbortSignal`

An AbortSignal that can be used to cancel the AppleScript execution.

### runAppleScriptSync(script, options?)

Returns a `string` with the script result.

#### script

Type: `string`

The script to run.

#### options

Type: `object`

##### humanReadableOutput

Type: `boolean`\
Default: `true`

Change the output style.

When `false`, returns the value in a [recompilable source form](https://ss64.com/osx/osascript.html).

## Related

- [run-jxa](https://github.com/sindresorhus/run-jxa) - Run JXA code and get the result

---
_Source: https://npm.io/package/run-applescript · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
