> ## Documentation Index
> Fetch the complete documentation index at: https://bun.manicule.dev/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://bun.manicule.dev/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://bun.manicule.dev/api/mcp.
> Every agent surface: https://bun.manicule.dev/.well-known/llms-manifest.json

# Get the absolute path to the current entrypoint (/guides/util/main)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 137 · updated: 2026-08-02 -->
Related: [Upgrade Bun to the latest version](/guides/util/upgrade.md), [Detect when code is executed with Bun](/guides/util/detect-bun.md), [Get the current Bun version](/guides/util/version.md), [Hash a password](/guides/util/hash-a-password.md), [Generate a UUID](/guides/util/javascript-uuid.md), [Encode and decode base64 data](/guides/util/base64.md)

The `Bun.main` property contains the absolute path to the current entrypoint.

<CodeGroup>
```ts title="foo.ts" icon="/icons/typescript.svg"
console.log(Bun.main);
```

```ts title="index.ts" icon="/icons/typescript.svg"
import "./foo.ts";
```
</CodeGroup>

***

The printed path is the file executed with `bun run`.

```sh icon="terminal" title="terminal" terminal
bun run index.ts
```

```txt
/path/to/index.ts
```

```sh icon="terminal" title="terminal" terminal
bun run foo.ts
```

```txt
/path/to/foo.ts
```

***

See [Utils](/runtime/utils).
